v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

TreeView

Hierarchical selection with explicit keyboard behavior.

Interactive preview

  • Source
    • App.tsx
  • 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:

PropTypeDefaultDescription
itemsTreeNode[]requiredRecursive nodes with ids, labels and optional disabled.
value / defaultValuestringemptySelected node id.
defaultExpandedreadonly 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-view

Make 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.