Hextech UI

Tree

Live example

Tree

  • Builds
    • Support
  • Practice

Use Alt + ↑ or ↓ to reorder, or the move buttons.

Installation

Terminal
npx shadcn@latest add https://hextech-ui.vercel.app/r/tree.json

API reference

These are the main Tree options. See the exported TypeScript types for inherited native or primitive props.

PropTypeDefault
labelstring (required)—
nodesreadonly TreeNodeData[]—
expandedKeys / selectedKeysreadonly string[]uncontrolled
selectionModenone | single | multiplesingle
onMove(move: TreeMove) => void—
loading / onLoadMoreboolean / callbackfalse / —

Dynamic collections

Give every node a unique stable ID. Own expanded and selected keys when the application needs to persist them. Keyboard moves use the separate onMove contract; no drag-and-drop API is distributed.