Tree view
An expandable hierarchy with selection and meta text.
- Design3
- Brief.pdf2.4 MB
- Moodboard.fig18 MB
- Logo lockups.png640 KB
- Build2
- Spec.md12 KB
- Tokens.json4 KB
- Launch1
- Launch plan.md9 KB
When to use
- Folders, categories and org charts.
- Items that have a clear parent and child.
When not to use
- File navigation with keyboard type-ahead; use the file tree.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/tree-view
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
TreeView
9 props
PropTypeDefault
label *string—
items *readonly TreeItem[]—
selectedstring | null—
defaultSelectedstring | nullnull
onSelect((id: string) => void)—
expandedreadonly string[]—
defaultExpandedreadonly string[][]
onExpandedChange((ids: string[]) => void)—
classNamestring—
Keyboard
- ↓
- Moves to the next item or value.
- ↑
- Moves to the previous item or value.
- Home
- Jumps to the first item or the minimum.
- End
- Jumps to the last item or the maximum.
- →
- Moves to the next item or value.
- ←
- Moves to the previous item or value.
- Enter
- Activates the focused control.
- Space
- Activates the focused control.
Accessibility
It exposes treeitem, group and tree semantics, with aria-level, aria-setsize, aria-posinset, aria-expanded, aria-selected and aria-disabled kept in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/tree-view.mdThe index of every part is at /llms.txt.