TreeView
Hierarchical tree structure with expandable nodes, selection, and keyboard navigation.
Examples
Basic
Static tree showing a collapsed file hierarchy.
Expanded
File tree with nested directories fully expanded.
With selection
Click any node to highlight it as selected.
Nested interactive
Click folder nodes to expand or collapse their children.
Installation
pnpm add @rokle/components @rokle/tokensInstalls with the default Rokle brand. Generate a custom brand on rokle.app to use your own colours and personality.
Usage
import { TreeView } from "@rokle/components";import { TreeView } from "@rokle/components";
export function Example() {
return <TreeView />;
}API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| data | TreeNode[] | - | Nested tree data with id, label, and optional children. |
| selectedId | string | - | ID of the currently selected node. |
| onSelect | (id: string) => void | - | Called when a node is selected. |