Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to create 2 columns #402

Unanswered
squirrelfeng asked this question in Q&A
Discussion options

I want to create a page with two columns, and put my text block into left column, may I ask how to achive this?
Thanks!

You must be logged in to vote

Replies: 1 comment

Comment options

@squirrelfeng You need to append the ColumnListBlock with supported ColumBlock based on how many columns you need. Attach the Children blocks inside the column need.

Simple Example.

This add two columns with a heading block as child on a page.

var leftColumn = new ColumnBlockRequest()
{
	Column = new ColumnBlockRequest.Info()
	{
		Children = new[]
		{
			new HeadingOneBlockRequest()
			{
				Heading_1 = new HeadingOneBlockRequest.Info()
				{
					RichText = new List<RichTextBase>()
					{
						new RichTextTextInput()
						{
							Text = new Text() { Content = "Left" }
						}
					}
				}
			}
		}
	}
};
var rightColumn = new ColumnBlockRequest()
{
	Column = new ColumnBlockRequest.Info()
	{
		Children = new[]
		{
			new HeadingOneBlockRequest()
			{
				Heading_1 = new HeadingOneBlockRequest.Info()
				{
					RichText = new List<RichTextBase>()
					{
						new RichTextTextInput()
						{
							Text = new Text() { Content = "Right" }
						}
					}
				}
			}
		}
	}
};
var request = new BlockAppendChildrenRequest()
{
	BlockId = _page.Id,
	Children = new List<IBlockObjectRequest>()
	{
		new ColumnListBlockRequest()
		{
			ColumnList = new ColumnListBlockRequest.Info()
			{
				Children = new List<ColumnBlockRequest>()
				{
					leftColumn,
					rightColumn
				}
			}
		}
	}
};
await Client.Blocks.AppendChildrenAsync(request);
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /