Skip to content
Nana UI

Tree

A hierarchical list for file systems, navigation, and any parent-child data. Compose nana-tree-item nodes inside it. Implements the ARIA tree pattern: roving tabindex, arrow-key navigation, type-ahead, and Home/End/* support.

Parent Child one Child two
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/tree";
<nana-tree style="width:100%">
<nana-tree-item>
Parent
<nana-tree-item>Child one</nana-tree-item>
<nana-tree-item>Child two</nana-tree-item>
</nana-tree-item>
</nana-tree>
PropertyTypeDefaultDescription
selection'single' | 'multiple' | 'none''single'Selection behaviour.
labelstring''Accessible name for the tree.
size'compact' | 'default' | 'spacious''default'Density scale.
EventTypeDescription
nana-selection-changeCustomEventSelection changed (detail.selection).
nana-expandCustomEventA branch expanded (detail.item).
nana-collapseCustomEventA branch collapsed (detail.item).
SlotDescription
(default)The top-level nana-tree-item nodes.
VariableDefaultDescription
--nana-tree-indentIndent step per depth level.
--nana-tree-row-heightNode row height.
--nana-tree-connectorConnector line colour.
PartDescription
baseThe tree container
  • Keyboard accessible
  • Screen-reader labels
  • Focus-visible states
  • ARIA roles and states
  • WCAG 2.2 AA contrast
Explore Tree interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook