Tree view
Navigate nested folders and structured content.
npx shadcn@latest add @silicon-ui/tree-viewInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/tree-viewManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/tree-view/tree-view.tsx
- components/silicon-ui/tree-view/tree-view.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/lib/fluid-hover.tsx
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
nodes* | TreeNode[] | — |
defaultExpandedIds | string[] | [] |
expandedIds | string[] | — |
onExpandedChange | (expandedIds: string[]) => void | — |
onSelect | (node: TreeNode) => void | — |
aria-label | string | — |
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens