Lumeo

TreeView

A hierarchical tree structure with expand/collapse, checkboxes, and search.

Installation

dotnet add package Lumeo

One-time app setup (AddLumeo(), CSS & JS) is covered in the installation guide.

Usage

@using Lumeo

<TreeView />

When to Use

  • File browsers and directory explorers with nested folder structures
  • Nested categories such as product taxonomies or menu hierarchies
  • Hierarchical data display like org charts or project breakdowns
  • Multi-level selection where parent-child relationships matter
Documents
Resume.pdf
Cover Letter.docx
Photos
Vacation
beach.jpg
sunset.jpg
profile.png
Music
playlist.m3u
Documents
Resume.pdf
Cover Letter.docx
Photos
Vacation
beach.jpg
sunset.jpg
profile.png
Music
playlist.m3u
Documents
Resume.pdf
Cover Letter.docx
Photos
Vacation
beach.jpg
sunset.jpg
profile.png
Music
playlist.m3u
docs
Documents
Resume.pdf
Cover Letter.docx
Photos
Vacation
beach.jpg
sunset.jpg
profile.png
Music
playlist.m3u
Documents
Resume.pdf
Cover Letter.docx
Photos
Vacation
beach.jpg
sunset.jpg
profile.png
Music
playlist.m3u

Click a node above.

Click any node to see its label reported below the tree.

Documents
Resume.pdf
Cover Letter.docx
Photos
Vacation
beach.jpg
sunset.jpg
profile.png
Music
playlist.m3u

API Reference

TreeView<T>

Property Type Default Description
ItemsList<TreeViewItem<T>>?nullTree data source.
ShowCheckboxesboolfalseShow checkboxes on each node.
CascadeCheckbooltrueWhen true, checking a parent automatically checks its children and parent state reflects an indeterminate state when only some children are checked.
ExpandablebooltrueAllow expanding/collapsing nodes.
ExpandOnRowClickbooltrueWhen true, clicking anywhere on a parent row both selects it and toggles its expansion (VS Code file-tree pattern). Set false to make the chevron the sole expand trigger, so a row click only selects. Leaf rows always just select; the chevron, keyboard (Arrow keys), and a Ctrl/Shift-modifier click are unaffected.
ExpandAllboolfalseWhen true, all nodes start expanded.
ShowSearchboolfalseShow search filter above the tree.
MultiSelectboolfalseEnables selecting multiple nodes at once.
SelectedValuesList<T>?nullCurrently selected node values (multi-select). Use with @bind-SelectedValues.
SelectedValuesChangedEventCallback<List<T>>Callback invoked when the selection changes.
LoadChildrenFunc<TreeViewItem<T>, Task<List<TreeViewItem<T>>>>?nullAsync function to lazily load children when a node is first expanded. The node's IsLoading flag is set while the task runs.
CheckedValuesChangedEventCallback<List<T?>>Callback invoked with all currently-checked values whenever a checkbox is toggled.
NodeTemplateRenderFragment<TreeViewItem<T>>?nullCustom template for the label area of each node. Receives the TreeViewItem as context.
OnItemClickEventCallback<TreeViewItem<T>>Fired when a node is clicked.
OnItemCheckEventCallback<TreeViewItem<T>>Fired when a node checkbox is toggled.

TreeView<T> Public Methods

Method Description
ExpandAllNodes()Programmatically expands every node in the tree.
CollapseAllNodes()Programmatically collapses every node in the tree.

TreeViewNode<T>

The per-node renderer TreeView uses internally to draw each row and recurse into its children. Selected parameters below are documented for reference; most consumers configure the tree via TreeView<T> rather than using TreeViewNode<T> directly.

Property Type Default Description
ItemTreeView<T>.TreeViewItem<T>The tree item this node renders.
Levelint0Nesting depth (0 = root); drives indentation and the aria-level attribute.
PosInSetint11-based position among the currently-visible siblings at this level, exposed as aria-posinset.
SetSizeint1Total number of currently-visible siblings at this level, exposed as aria-setsize.
SelectedNodesHashSet<TreeView<T>.TreeViewItem<T>>?nullThe set of currently-selected node instances (reference-identity), owned and threaded down by the parent TreeView.
OnSelectionChangedEventCallback<TreeView<T>.TreeViewItem<T>>Fired when this node is selected via row click or Enter/Space; TreeView uses it internally to update SelectedNodes and SelectedValues.

TreeViewItem<T>

Property Type Description
TextstringDisplay label for the node.
ValueT?Application-domain value associated with the node.
ChildrenList<TreeViewItem<T>>?Child nodes. Null/empty = leaf node unless IsLeaf is set.
IsExpandedboolWhether the node is currently expanded.
IsCheckedboolWhether the node's checkbox is checked.
IsIndeterminateboolTrue when some (but not all) children are checked — shown as a mixed/indeterminate checkbox.
IsLeafboolWhen true, hides the expand chevron and the loading indicator even if the node has no children yet.
IsLoadingboolSet automatically while LoadChildren is running. Renders a spinner in place of the chevron.
IsDisabledboolDisables the node so it cannot be clicked or checked.
IconIconSource?Optional icon rendered before the node label (a Lumeo.IconSource).
  • Accordion — Collapsible sections without hierarchical nesting
  • SortableList — Reorderable flat lists with drag-and-drop