v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS
TreeView
Hierarchical selection with explicit keyboard behavior.
Interactive preview
- Source
- App.tsx
- Styles
- README.md
- Private config
Usage
import { TreeView } from "@devvy-ui/react";
<TreeView label="Project files" items={[{id:'src',label:'Source',children:[{id:'app',label:'App.tsx'}]}]} />API reference
Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:
| Prop | Type | Default | Description |
|---|---|---|---|
| items | TreeNode[] | required | Recursive nodes with ids, labels and optional disabled. |
| value / defaultValue | string | empty | Selected node id. |
| defaultExpanded | readonly string[] | [] | Initially open branches. |
| onValueChange | (id: string) => void | — | Selection callback. |
Accessibility & behavior
Platform Behavior & Guidelines
Arrow keys navigate visible enabled items, expand/collapse branches and follow parents; Home/End and character search are supported. IDs must be unique throughout the tree.
Source ownership
Run npx @devvy-ui/cli init once in your React project, then add the source:
npx @devvy-ui/cli add tree-viewMake the source yours.
Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.
TreeView.tsxREACT / TSX
Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.