Tree
A hierarchical, expandable tree with single selection and keyboard support.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
A hierarchical, expandable tree with single selection and keyboard support.
Accessibility
Rendered as a real <table> with header scopes; sortable columns expose aria-sort. Row selection and actions are keyboard reachable.
Install and import
npx shadcn@latest add @prism/tree
import { Tree } from '@/components/prism/Tree';
In a no-build prototype, read it from the bundle instead: const { Tree } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
items | TreeNodeData[] | Yes | |
defaultExpandedKeys | string[] | — | |
selectedKey | string | null | — | Controlled selected node id. |
onSelectionChange | (id: string, node: TreeNodeData) => void | — | |
className | string | — |