Skip to main content
Pricing

Tree View

Pro

An expandable, hierarchical list for displaying nested data like file systems, categories, and organisational structures. Each node can be expanded or collapsed to reveal children. Supports single and multi-selection, drag-and-drop reordering, and lazy loading of deep branches.

4 variants

src
components
Button.tsx
Input.tsx
utils
README.md

Variants

VariantDescriptionWhen to use
DefaultStandard tree view with expandable/collapsible nodes.Use for file browsers, category trees, and organisation hierarchies.
With Checkboxes

Usage Guidelines

Do

Use role="tree" on the container and role="treeitem" on each node.

Don't

Nest more than 5–6 levels deep — consider a different navigation pattern.

Do

Set aria-expanded="true" or "false" on expandable nodes.

Don't

Auto-expand all nodes on load — start collapsed and let users explore.

Do

Indent child nodes visually and semantically with aria-level.

Don't

Use a tree view for flat lists — use a standard list instead.

Code

This component is included in Lexicon Pro

From €149 — one-time purchase, lifetime access

View pricing

Design Tokens

This component is included in Lexicon Pro

From €149 — one-time purchase, lifetime access

View pricing

Accessibility

  • Container must use role="tree"; each node uses role="treeitem".
  • Expandable nodes need aria-expanded="true" or "false".
  • Use aria-level to indicate depth for screen readers.
  • Group child nodes with role="group" inside the parent treeitem.
  • Selected nodes use aria-selected="true".

Keyboard Interactions

ArrowDownMoves focus to the next visible tree item.
ArrowUpMoves focus to the previous visible tree item.
ArrowRightExpands the focused node if collapsed, or moves to first child.
ArrowLeftCollapses the focused node if expanded, or moves to parent.
Enter/SpaceActivates or selects the focused tree item.
HomeMoves focus to the first tree item.
EndMoves focus to the last visible tree item.
* (Asterisk)Expands all sibling nodes at the current level.