Aliases
tree
TreeViewSingle-select hierarchy with branch expansion and keyboard navigation.
Aliases
tree
Foundations
TreeView for nested resources that users expand in place.TreeView when the structure is effectively flat.TreeView for drag-and-drop, typeahead-heavy, or multi-select trees.tree row
item Single hierarchical row with level, selection, and branch state.
expand and collapse control
branch Opens or closes a node with children.
supporting node text
description Optional secondary copy beneath the main label.
| Name | Type | Default | Description |
|---|---|---|---|
items | Array<{ id: string; label: string; description?: string; disabled?: boolean; children?: TreeViewItem[] }> | — | Tree definitions with nested child arrays. |
value | string | — | Controlled selected node ID. |
expandedIds | string[] | — | Controlled expanded branch IDs. |
onChange | (detail: { value: string | undefined }) => void | — | Runs when the selected node changes. |
onExpandedChange | (detail: { ids: string[] }) => void | — | Runs when the expanded branch set changes. |
theme | ThemeContract | — | Sets the theme used to resolve component styles. |
| Name | Payload | Description |
|---|---|---|
change | { value: string | undefined } | Fires when the component commits a new value. |
expandedchange | { ids: string[] } | Fires when expanded branches change. |
| Name | Description |
|---|---|
default | TreeView is data-driven and does not expose node slots. |
Variants
default: Single-select hierarchical tree with depth indentation.Sizes
default: TreeView uses one density tuned for readable hierarchy.States
collapsed: Branch closedexpanded: Branch openselected: Current node selectedSemantics
Keyboard
Screen readers
Checklist
Implementation notes
TreeView supports one selected item.A readable hierarchical list with one expanded branch.
<TreeView items={treeItems} expandedIds={['workspace']} value="overview" /> Descriptions can clarify similarly named nodes without changing the structure.
<TreeView items={[{ id: 'workspace', label: 'Workspace', children: [{ id: 'activity', label: 'Activity', description: 'Recent events' }] }]} expandedIds={['workspace']} /> Control selection and expanded branches when app state owns the hierarchy.
<TreeView items={treeItems} value={selectedNode} expandedIds={expanded} onChange={(detail) => selectedNode = detail.value} onExpandedChange={(detail) => expanded = detail.ids} /> Calculated fixtures; browser evidence is not collected. Layout estimates use declared text behavior and maximum token values.