Skip to Content
ComponentsTreeView

TreeView

TreeView renders nested expandable lists with Windows 98 branch markers and roving keyboard focus.

Props

ExportKey propsDescription
TreeViewchildren, classNameRoot tree container.
TreeViewItemlabel, icon, defaultExpanded, expanded, onExpandedChange, selected, preventCollapse, disabled, onClickLeaf or branch item.

Examples

Explorer tree

  • Desktop
    • My Computer
    • Network Neighborhood
    • Control Panel
      • Display
      • Mouse
  • Recycle Bin

ARIA

TreeView uses role="tree", role="treeitem", role="group", and aria-expanded on branch summaries. Arrow keys move through visible items and expand or collapse branches.

Keyboard

ArrowUp and ArrowDown move focus through visible enabled items without wrapping. ArrowRight expands a collapsed branch or moves into its first child. ArrowLeft collapses an expanded branch or moves focus to the parent. Home and End move to the first and last visible enabled item. Enter and Space activate clickable leaf items.

SSR

Use defaultExpanded for uncontrolled branches. Use controlled expanded when state must be restored from app data.

Last updated on