-
Notifications
You must be signed in to change notification settings - Fork 53
How to create 2 columns #402
Unanswered
squirrelfeng
asked this question in
Q&A
-
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!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
@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);
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment