A hierarchical tree view component for displaying nested data structures with expand/collapse functionality. RadzenTree supports both inline item definition and data-binding for displaying file systems, organization charts, category hierarchies, or any tree-structured data. Organizes data in a parent-child hierarchy where items can be expanded to reveal children. Supports static definition declaring tree structure using nested RadzenTreeItem components, data binding to hierarchical data using RadzenTreeLevel components, single or multiple item selection with checkboxes, individual item or programmatic expand/collapse control, custom icons per item or data-bound icon properties, custom rendering templates for tree items, keyboard navigation (Arrow keys, Space/Enter, Home/End) for accessibility, and Change/Expand/selection events. For data binding, use RadzenTreeLevel to define how to render each hierarchy level from your data model. For checkbox selection, use AllowCheckBoxes and bind to CheckedValues.
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenTree : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRenderStatic tree with inline items:
<RadzenTree>
<RadzenTreeItem Text="Documents" Icon="folder">
<RadzenTreeItem Text="Work" Icon="folder">
<RadzenTreeItem Text="report.pdf" Icon="description" />
</RadzenTreeItem>
<RadzenTreeItem Text="Personal" Icon="folder">
<RadzenTreeItem Text="photo.jpg" Icon="image" />
</RadzenTreeItem>
</RadzenTreeItem>
</RadzenTree>
Data-bound tree with selection:
<RadzenTree Data=@categories AllowCheckBoxes="true" @bind-CheckedValues=@selectedCategories Change=@OnChange>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children" />
</RadzenTree>
@code {
IEnumerable<object> selectedCategories;
void OnChange(TreeEventArgs args) => Console.WriteLine($"Selected: {args.Text}");
}A hierarchical tree view component for displaying nested data structures with expand/collapse functionality. RadzenTree supports both inline item definition and data-binding for displaying file systems, organization charts, category hierarchies, or any tree-structured data. Organizes data in a parent-child hierarchy where items can be expanded to reveal children. Supports static definition declaring tree structure using nested RadzenTreeItem components, data binding to hierarchical data using RadzenTreeLevel components, single or multiple item selection with checkboxes, individual item or programmatic expand/collapse control, custom icons per item or data-bound icon properties, custom rendering templates for tree items, keyboard navigation (Arrow keys, Space/Enter, Home/End) for accessibility, and Change/Expand/selection events. For data binding, use RadzenTreeLevel to define how to render each hierarchy level from your data model. For checkbox selection, use AllowCheckBoxes and bind to CheckedValues.
public RadzenTree()Specifies whether RadzenTree displays check boxes. Set to false by default.
public bool AllowCheckBoxes { get; set; }
| Type | Description |
|---|---|
| bool | Specifies whether RadzenTree displays check boxes. Set to false by default. |
Specifies what happens when a parent item is checked. If set to true checking parent items also checks all of its children.
public bool AllowCheckChildren { get; set; }
| Type | Description |
|---|---|
| bool | Specifies what happens when a parent item is checked. If set to true checking parent items also checks all of its children. |
Specifies what happens with a parent item when one of its children is checked. If set to true checking a child item will affect the checked state of its parents.
public bool AllowCheckParents { get; set; }
| Type | Description |
|---|---|
| bool | Specifies what happens with a parent item when one of its children is checked. If set to true checking a child item will affect the checked state of its parents. |
A callback that will be invoked when the user selects an item.
public EventCallback<TreeEventArgs> Change { get; set; }
| Type | Description |
|---|---|
| EventCallback<TreeEventArgs> | A callback that will be invoked when the user selects an item. |
<RadzenTree Change=@OnChange>
<RadzenTreeItem Text="BMW">
<RadzenTreeItem Text="M3" />
<RadzenTreeItem Text="M5" />
</RadzenTreeItem>
<RadzenTreeItem Text="Audi">
<RadzenTreeItem Text="RS4" />
<RadzenTreeItem Text="RS6" />
</RadzenTreeItem>
<RadzenTreeItem Text="Mercedes">
<RadzenTreeItem Text="C63 AMG" />
<RadzenTreeItem Text="S63 AMG" />
</RadzenTreeItem>
</RadzenTree>
@code {
void OnChange(TreeEventArgs args)
{
}
}Gets or sets the checked values. Use with @bind-CheckedValues to sync it with a property.
public IEnumerable<object> CheckedValues { get; set; }
| Type | Description |
|---|---|
| IEnumerable<object> | Gets or sets the checked values. Use with @bind-CheckedValues to sync it with a property. |
A callback which will be invoked when CheckedValues changes.
public EventCallback<IEnumerable<object>> CheckedValuesChanged { get; set; }
| Type | Description |
|---|---|
| EventCallback<IEnumerable<object>> | A callback which will be invoked when CheckedValues changes. |
Gets or sets the child content.
public RenderFragment ChildContent { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets the child content. |
A callback that will be invoked when the user collapse an item.
public EventCallback<TreeEventArgs> Collapse { get; set; }
| Type | Description |
|---|---|
| EventCallback<TreeEventArgs> | A callback that will be invoked when the user collapse an item. |
Specifies the collection of data items which RadzenTree will create its items from.
public Collections.IEnumerable Data { get; set; }
| Type | Description |
|---|---|
| Collections.IEnumerable | Specifies the collection of data items which RadzenTree will create its items from. |
A callback that will be invoked when the user expands an item.
public EventCallback<TreeExpandEventArgs> Expand { get; set; }
| Type | Description |
|---|---|
| EventCallback<TreeExpandEventArgs> | A callback that will be invoked when the user expands an item. |
<RadzenTree Expand=@OnExpand>
<RadzenTreeItem Text="BMW">
<RadzenTreeItem Text="M3" />
<RadzenTreeItem Text="M5" />
</RadzenTreeItem>
<RadzenTreeItem Text="Audi">
<RadzenTreeItem Text="RS4" />
<RadzenTreeItem Text="RS6" />
</RadzenTreeItem>
<RadzenTreeItem Text="Mercedes">
<RadzenTreeItem Text="C63 AMG" />
<RadzenTreeItem Text="S63 AMG" />
</RadzenTreeItem>
</RadzenTree>
@code {
void OnExpand(TreeExpandEventArgs args)
{
}
}Gets or sets the CSS classes added to the item content.
public string ItemContentCssClass { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the CSS classes added to the item content. |
Gets or sets the context menu callback.
public EventCallback<TreeItemContextMenuEventArgs> ItemContextMenu { get; set; }
| Type | Description |
|---|---|
| EventCallback<TreeItemContextMenuEventArgs> | Gets or sets the context menu callback. |
Gets or sets the CSS classes added to the item icon.
public string ItemIconCssClass { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the CSS classes added to the item icon. |
Gets or sets the CSS classes added to the item label.
public string ItemLabelCssClass { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the CSS classes added to the item label. |
A callback that will be invoked when item is rendered.
public Action<TreeItemRenderEventArgs> ItemRender { get; set; }
| Type | Description |
|---|---|
| Action<TreeItemRenderEventArgs> | A callback that will be invoked when item is rendered. |
Gets or sets the open button aria-label attribute.
public string SelectItemAriaLabel { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the open button aria-label attribute. |
Specifies whether siblings items are collapsed. Set to false by default.
public bool SingleExpand { get; set; }
| Type | Description |
|---|---|
| bool | Specifies whether siblings items are collapsed. Set to false by default. |
Specifies the selected value. Use with @bind-Value to sync it with a property.
public object Value { get; set; }
| Type | Description |
|---|---|
| object | Specifies the selected value. Use with @bind-Value to sync it with a property. |
A callback which will be invoked when Value changes.
public EventCallback<object> ValueChanged { get; set; }
| Type | Description |
|---|---|
| EventCallback<object> | A callback which will be invoked when Value changes. |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | __builder |
Clear the current selection to allow re-selection by mouse click
public void ClearSelection()protected override string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
Forces the specified item or, if item is null, all items in the tree to be re-evaluated such that items lazily created via Expand are realised if the underlying data model has been changed from somewhere else.
public Task Reload(RadzenTreeItem item)
| Type | Name | Description |
|---|---|---|
| RadzenTreeItem | item | The item to be reloaded or null to refresh the root nodes of the tree. |
| Type | Description |
|---|---|
| Task | A task to wait for the operation to complete. |
public override Task SetParametersAsync(ParameterView parameters)
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters |
| Type | Description |
|---|---|
| Task |