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

ParameterDefaultType
AutoExpandAllfalsebool

Specifies if the treenode should be automatically expanded. Note that it can happen only once when the tree is first loaded.
ChildContentnullRenderFragment

Specifies the content to be rendered inside this TreeView.
CollapseIconNameChevronDownIconName

Specifies the name of the treenode collapse icon.
CollapseIconSizenullIconSize?

Specifies the size of the treenode collapse icon.
CollapseIconStylenullIconStyle?

Specifies the style of the treenode collapse icon.
Draggablefalsebool

Enables TreeView nodes to be dragged with the browser drag-and-drop API.
ExpandedNodesnew List<TNode>()IList<TNode>

List of currently expanded TreeView items (child nodes).
ExpandIconNameChevronRightIconName

Specifies the name of the treenode expand icon.
ExpandIconSizenullIconSize?

Specifies the size of the treenode expand icon.
ExpandIconStylenullIconStyle?

Specifies the style of the treenode expand icon.
NodeContentnullRenderFragment<TNode>

Template to display content for the node
NodeContextMenuPreventDefaultfalsebool

Used to prevent the default action for a NodeContextMenu event.
NodesnullIEnumerable<TNode>

Collection of child TreeView items (child nodes)
Reorderablefalsebool

Enables dropping a dragged node before another node instead of only dropping it as a child.
SelectedNodenullTNode

Currently selected TreeView item/node.
SelectedNodesnullIList<TNode>

Currently selected TreeView items/nodes.
SelectionModeTreeViewSelectionMode.SingleTreeViewSelectionMode

Specifies the selection mode of the TreeView.
Possible values:SingleMultiple
Virtualizefalsebool

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

EventType
CanDragNodeFunc<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.
CanDropNodeFunc<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.
DisabledNodeStylingAction<TNode, NodeStyling>

Defines styling applied to disabled nodes.
ExpandedNodesChangedEventCallback<IList<TNode>>

Notifies when the collection of expanded nodes has changed.
GetChildNodesFunc<TNode, IEnumerable<TNode>>

Gets the list of child nodes for each node.
GetChildNodesAsyncFunc<TNode, Task<IEnumerable<TNode>>>

Gets the list of child nodes for each node.
HasChildNodesFunc<TNode, bool>

Indicates if the node has child elements.
HasChildNodesAsyncFunc<TNode, Task<bool>>

Indicates if the node has child elements.
IsDisabledFunc<TNode, bool>

Indicates the node's disabled state. Used for preventing selection.
NodeContextMenuEventCallback<TreeViewNodeMouseEventArgs<TNode>>

The event is fired when the node is right clicked to show the context menu.
NodeDroppedEventCallback<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.
NodeStylingAction<TNode, NodeStyling>

Defines styling applied to nodes.
SelectedNodeChangedEventCallback<TNode>

Notifies when the selected TreeView node has changed.
SelectedNodesChangedEventCallback<IList<TNode>>

Notifies when the selected TreeView nodes has changed.
SelectedNodeStylingAction<TNode, NodeStyling>

Defines styling applied to selected nodes.

Methods

MethodReturnParameters
CollapseAllTask—

Collapses all the expanded TreeView nodes.
ExpandAllTask—

Expands all the collapsed TreeView nodes.
ReloadNodeTaskTNode node

Triggers the reload of a specific node and its subtree.
ReloadTask—

Triggers the reload of the Nodes.
RemoveNodeTaskTNode node

Attempts to find and remove an existing node from the Treeview.
SelectNodevoidTNode node

Selects the node when in single selection mode.
ToggleCheckNodeTaskTNode node

Toggles the checked state of the node when in multiple selection mode.
On this page