Tree View
A Windows 98 tree view for nested items.
pnpm dlx shadcn@latest add https://react98-ui.vercel.app/r/tree-view.json
npx shadcn@latest add https://react98-ui.vercel.app/r/tree-view.json
yarn dlx shadcn@latest add https://react98-ui.vercel.app/r/tree-view.json
bunx shadcn@latest add https://react98-ui.vercel.app/r/tree-view.json
import { TreeView, type TreeNode } from "@/components/ui/98/tree-view";
const nodes: TreeNode[] = [
{
id: "desktop",
label: "Desktop",
children: [{ id: "computer", label: "My Computer" }],
},
];
export function Example() {
return <TreeView nodes={nodes} />;
}
| Prop | Type | Description |
|---|
nodes | TreeNode[] | Tree nodes to render recursively. |
... | HTMLAttributes<HTMLUListElement> | All native list attributes pass through. |
| Prop | Type | Description |
|---|
id | string | Stable key for the node. |
label | ReactNode | Displayed node label. |
children | TreeNode[] | Optional child nodes. |