Blazorise Tree View API
Explore the Blazorise Tree View API reference for parameters, events, methods, and related types.
For examples and usage guidance, see the Tree View documentation.
API
Parameters
| Parameter | Default | Type |
|---|---|---|
AutoExpandAll | false | bool |
Specifies if the treenode should be automatically expanded. Note that it can happen only once when the tree is first loaded. | ||
ChildContent | null | RenderFragment |
Specifies the content to be rendered inside this TreeView. | ||
CollapseIconName | ChevronDown | IconName |
Specifies the name of the treenode collapse icon. | ||
CollapseIconSize | null | IconSize? |
Specifies the size of the treenode collapse icon. | ||
CollapseIconStyle | null | IconStyle? |
Specifies the style of the treenode collapse icon. | ||
Draggable | false | bool |
Enables TreeView nodes to be dragged with the browser drag-and-drop API. | ||
ExpandedNodes | new List<TNode>() | IList<TNode> |
List of currently expanded TreeView items (child nodes). | ||
ExpandIconName | ChevronRight | IconName |
Specifies the name of the treenode expand icon. | ||
ExpandIconSize | null | IconSize? |
Specifies the size of the treenode expand icon. | ||
ExpandIconStyle | null | IconStyle? |
Specifies the style of the treenode expand icon. | ||
NodeContent | null | RenderFragment<TNode> |
Template to display content for the node | ||
NodeContextMenuPreventDefault | false | bool |
Used to prevent the default action for a NodeContextMenu event. | ||
Nodes | null | IEnumerable<TNode> |
Collection of child TreeView items (child nodes) | ||
Reorderable | false | bool |
Enables dropping a dragged node before another node instead of only dropping it as a child. | ||
SelectedNode | null | TNode |
Currently selected TreeView item/node. | ||
SelectedNodes | null | IList<TNode> |
Currently selected TreeView items/nodes. | ||
SelectionMode | TreeViewSelectionMode.Single | TreeViewSelectionMode |
Specifies the selection mode of the TreeView. Possible values: SingleMultiple | ||
Virtualize | false | bool |
Controls if the child nodes, which are currently not expanded, are visible. This is useful for optimizing large TreeViews. See Docs for virtualization for more info. When virtualization is enabled after rendering, an omitted Height becomes 300px and an omitted Overflow becomes Auto. | ||
Events
| Event | Type |
|---|---|
CanDragNode | Func<TNode, bool> |
Determines whether the specified node can be dragged. The default predicate returns true for every node. Dragging must still be enabled with Draggable. | |
CanDropNode | Func<TreeViewNodeDragEventArgs<TNode>, bool> |
Determines whether a proposed drop operation is allowed. The default predicate returns true for every drop. The tree's drag-and-drop restrictions still apply. | |
DisabledNodeStyling | Action<TNode, NodeStyling> |
Defines styling applied to disabled nodes. | |
ExpandedNodesChanged | EventCallback<IList<TNode>> |
Notifies when the collection of expanded nodes has changed. | |
GetChildNodes | Func<TNode, IEnumerable<TNode>> |
Gets the list of child nodes for each node. | |
GetChildNodesAsync | Func<TNode, Task<IEnumerable<TNode>>> |
Gets the list of child nodes for each node. | |
HasChildNodes | Func<TNode, bool> |
Indicates if the node has child elements. | |
HasChildNodesAsync | Func<TNode, Task<bool>> |
Indicates if the node has child elements. | |
IsDisabled | Func<TNode, bool> |
Indicates the node's disabled state. Used for preventing selection. | |
NodeContextMenu | EventCallback<TreeViewNodeMouseEventArgs<TNode>> |
The event is fired when the node is right clicked to show the context menu. | |
NodeDropped | EventCallback<TreeViewNodeDragEventArgs<TNode>> |
Occurs when a node is dropped on a valid target. When this callback is not handled, the TreeView tries to move the node in the bound mutable collections automatically. When handled, this callback overrides the built-in move behavior. | |
NodeStyling | Action<TNode, NodeStyling> |
Defines styling applied to nodes. | |
SelectedNodeChanged | EventCallback<TNode> |
Notifies when the selected TreeView node has changed. | |
SelectedNodesChanged | EventCallback<IList<TNode>> |
Notifies when the selected TreeView nodes has changed. | |
SelectedNodeStyling | Action<TNode, NodeStyling> |
Defines styling applied to selected nodes. | |
Methods
| Method | Return | Parameters |
|---|---|---|
CollapseAll | Task | — |
Collapses all the expanded TreeView nodes.
| ||
ExpandAll | Task | — |
Expands all the collapsed TreeView nodes.
| ||
ReloadNode | Task | TNode node |
Triggers the reload of a specific node and its subtree.
| ||
Reload | Task | — |
Triggers the reload of the Nodes.
| ||
RemoveNode | Task | TNode node |
Attempts to find and remove an existing node from the Treeview.
| ||
SelectNode | void | TNode node |
Selects the node when in single selection mode.
| ||
ToggleCheckNode | Task | TNode node |
Toggles the checked state of the node when in multiple selection mode.
| ||