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).
Tree lineage
Install
npx shadcn add @syncrobotic/tree Also installs: radix-ui, lucide-react, @syncrobotic/cn
Overview
A hierarchy from data, with a guide line per level: a nested list of links people open and close, or a tree widget to pick one node in.
When to use
- Data lineage: a release, the label sets it was trained on, and their sources.
- Sites › zones › robots, to read or to pick one.
- The folders and files of a dataset, as a file explorer.
Use something else
- One level of rows: Grouped list.
- Where this page sits among its parents: Breadcrumb.
- Sections of one page that open and close: Accordion.
- Rows with columns to compare: Data grid with expanding rows.
- Nodes with several parents (one source under two label sets, steps that run in parallel and meet): Graph.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Tree collapsed
Tree file explorer
Tree disabled
Tree empty
Usage rules
- list (default) for a hierarchy people read and follow links in: lineage, an outline. select only when choosing a node is the job (a file explorer, a site picker): it is one Tab stop with arrow keys, and its nodes are not links.
- A node used twice (a source under two label sets) is named again with a marker in meta, "(listed above)", not drawn twice in full. When many nodes have several parents, it is a Graph.
- meta is a count, a size or a calm state word, in muted text; never a coloured status. A disabled node says why in its meta.
- Open what people came for (defaultExpanded or expandAll for short trees); a deep tree starts collapsed.
- Give textValue when label is not a string, so type-ahead and screen readers have its name.
Changelog
- 0.27.02026-11-21An empty folder opens and closes in place; it opened as tall as its parent folder before snapping shut.
- 0.18.22026-11-21Compiles with noUncheckedIndexedAccess, as strict products build it; behaviour unchanged.
- 0.18.12026-11-21Type-ahead times letters by the key event's own timeStamp instead of calling Date.now() in the component, so it is safe under the React Compiler. Same half-second window.