Skip to content
Nana UI

Tree Item

A single node in a nana-tree. Branch nodes nest further nana-tree-item elements in the default slot; leaf nodes have none. The label comes from the label attribute (or the label slot for rich content).

Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/tree-item";
<nana-tree style="width:100%">
<nana-tree-item label="Parent" icon="folder" expanded>
<nana-tree-item label="Child" icon="code"></nana-tree-item>
</nana-tree-item>
</nana-tree>
PropertyTypeDefaultDescription
labelstring''Plain-text label. Ignored when the label slot is used.
iconstring | undefinedLeading icon name (a nana-icon name).
badgestring | undefinedTrailing badge text.
expandedbooleanfalseExpanded state of a branch node.
selectedbooleanfalseSelected state (the tree controls this).
disabledbooleanfalseDisabled — blocks selection, expansion, and keyboard interaction.
lazybooleanfalseTreat as a branch whose children load on first expand.
loadingbooleanfalseShow a loading spinner in place of the chevron.
isBranchbooleanWhether this node can expand.
itemsNanaTreeItem[]Direct child tree items.
EventTypeDescription
nana-tree-item-toggleCustomEventInternal: expanded state changed (handled by the tree).
nana-tree-item-activateCustomEventInternal: row activated (handled by the tree).
SlotDescription
(default)Child nana-tree-item nodes.
labelRich label content (overrides the label attribute).
PartDescription
itemThe node row (icon, label, and badge)
chevronThe expand/collapse chevron
iconThe leading icon
labelThe label
badgeThe trailing badge
childrenThe nested children container
Explore Tree Item interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook