Class ChildrenBlockSettings
Represents settings for container-style blocks that can host child blocks in the SfBlockEditor.
Inheritance
Inherited Members
Namespace: Syncfusion.Blazor.BlockEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class ChildrenBlockSettings : BlockSettings
Remarks
Use the ChildrenBlockSettings class to compose hierarchical content by nesting one or more BlockModel instances as children of a parent block. This is suitable for container blocks such as templates or other composite layouts.
Assign an instance of this settings class to BlockModel.Properties when the parent BlockModel.BlockType
supports child content. Populate the Children collection
with the blocks you want to render inside the container.
Performance: For large or deeply nested trees, batch modifications to reduce re-rendering and minimize allocations. Consider lazy loading or virtualizing deeply nested structures. This type is not thread-safe; update instances from the UI thread.
Examples
Creates a template block that contains child blocks (a heading and a bullet list) using ChildrenBlockSettings inside an SfBlockEditor component.
<SfBlockEditor @bind-Blocks="Blocks" />
@code {
private List<BlockModel> Blocks = new()
{
new BlockModel
{
ID = "template-1",
BlockType = BlockType.Template,
Properties = new ChildrenBlockSettings
{
Children = new List<BlockModel>
{
// Child heading
new BlockModel
{
ID = "child-heading",
BlockType = BlockType.Heading,
Properties = new HeadingBlockSettings { Level = 2 },
Content = new List<ContentModel>
{
new ContentModel { ID = "child-heading-content", ContentType = ContentType.Text, Content = "Nested Section" }
}
},
// Child bullet list
new BlockModel
{
ID = "child-bullets",
BlockType = BlockType.BulletList,
Properties = new BulletListBlockSettings { Placeholder = "Add a list item..." },
Content = new List<ContentModel>
{
new ContentModel { ID = "b1", ContentType = ContentType.Text, Content = "First nested item" },
new ContentModel { ID = "b2", ContentType = ContentType.Text, Content = "Second nested item" }
}
}
}
}
}
};
}
Constructors
ChildrenBlockSettings()
Declaration
public ChildrenBlockSettings()
Properties
Children
Gets or sets the collection of child blocks hosted by the parent block in the SfBlockEditor.
Declaration
public List<BlockModel> Children { get; set; }
Property Value
| Type | Description |
|---|---|
| List<BlockModel> | A List<T> of BlockModel representing the nested child blocks. The default value is an empty collection. |
Remarks
Use the Children list to define the structure and order of nested content within a container block The order of items determines their rendered order.
If Children is null, it is treated as empty and no child content is rendered. Avoid cyclical references (for example, a child referencing an ancestor) as they are not supported.
Performance: Batch modifications when adding or removing many child blocks to reduce re-rendering and allocations. Deeply nested hierarchies increase rendering cost and memory usage proportionally to tree size.