Skip to main content

Tree

A hierarchical, expandable tree with single selection and keyboard support.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When 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​

PropTypeRequiredDescription
itemsTreeNodeData[]Yes
defaultExpandedKeysstring[]—
selectedKeystring | null—Controlled selected node id.
onSelectionChange(id: string, node: TreeNodeData) =&gt; void—
classNamestring—