Data
TreeView
Collapsible tree structure for hierarchical data navigation.
Quick Preview
Installation
npm install lucide-react
// Copy fromsrc/components/data/TreeView.tsx
Examples
Selectable tree
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
nodes* | TreeNode[] | - | Root-level tree nodes |
defaultExpanded | (string | number)[] | [] | IDs of nodes expanded by default |
selectedId | string | number | - | Currently selected node ID |
onSelect | (node: TreeNode) => void | - | Selection callback |
className | string | - | Additional CSS classes |