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).
Show code Copy < nana-tree style = "width:100%" >
< nana-tree-item label = "Parent" icon = "folder" expanded >
< nana-tree-item label = "Child one" icon = "code" ></ nana-tree-item >
< nana-tree-item label = "Child two" icon = "code" selected ></ nana-tree-item >
</ nana-tree-item >
</ nana-tree >
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 >
Properties Property Attribute Type Default Description badge— string | undefined—Trailing badge text. disabled— booleanfalseDisabled — blocks selection, expansion, and keyboard interaction. expanded— booleanfalseExpanded state of a branch node. icon— string | undefined—Leading icon name (a `nana-icon` name). label— string''Plain-text label. Ignored when the `label` slot is used. lazy— booleanfalseTreat as a branch whose children load on first expand. loading— booleanfalseShow a loading spinner in place of the chevron. selected— booleanfalseSelected state (the tree controls this).
Events Event Description nana-tree-item-toggleInternal: expanded state changed (handled by the tree). nana-tree-item-activateInternal: row activated (handled by the tree).
Slots Slot Description (default)Child `nana-tree-item` nodes. labelRich label content (overrides the `label` attribute).
CSS parts Part Description ::part(item)The node row. ::part(chevron)The expand/collapse chevron. ::part(icon)The leading icon. ::part(label)The label. ::part(badge)The trailing badge. ::part(children)The nested children container.
Event Type Description nana-tree-item-toggleCustomEventInternal: expanded state changed (handled by the tree). nana-tree-item-activateCustomEventInternal: row activated (handled by the tree).
Slot Description (default)Child nana-tree-item nodes. labelRich label content (overrides the label attribute).
Part Description 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