rokle

Personality

20
40
70
15

Active brand: Meridian

Adjust sliders to see every component on the page respond in real time.

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/tokens

Installs 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

PropTypeDefaultDescription
dataTreeNode[]-Nested tree data with id, label, and optional children.
selectedIdstring-ID of the currently selected node.
onSelect(id: string) => void-Called when a node is selected.