Skip to content
Design System
GitHub

A hierarchy from data: a nested list with guide lines, disclosure buttons and links (list), or a tree widget with arrow keys, type-ahead and one selected node (select).

API reference

Generated from the types. Every part also takes className.

Tree

itemsrequired
TreeNode[]
labelrequired
stringNames the tree or list for screen readers: "Lineage", "Dataset files".
mode
"select" | "list" = "list"list (default): a nested list whose links and disclosure buttons are ordinary Tab stops. select: a tree widget (role="tree"), one Tab stop, arrow keys, and one selected node.
defaultExpanded
string[]Branches open at first (uncontrolled).
expanded
string[]Open branches, controlled; pair with onExpandedChange.
onExpandedChange
(expanded: string[]) => void
expandAll
booleanEvery branch open at first (uncontrolled), for short trees people read whole.
selectedId
stringselect mode: the selected node, controlled; pair with onSelectedChange.
defaultSelectedId
stringselect mode: the node selected at first (uncontrolled).
onSelectedChange
(id: string, node: TreeNode) => void
empty
ReactNode = "Nothing here yet."Shown instead of the tree when items is empty.
linkAs
ElementType = "a"Your router's link (e.g. next/link), for nodes with href in list mode.
labels
Partial<TreeLabels>