Tree

An arbitrary-depth hierarchical tree — recursive expand/collapse nodes with roving-tabindex keyboard navigation (WAI-ARIA Tree View), for file explorers, folder/nav sidebars, and threaded or org structures. Terse or composed items, selection (single / multiple with range + ⌘A), tri-state checkbox cascade, filter-to-reveal with highlighting, scroll-to-node, async lazy children, and inline rename.

Stablev0.3.0@garn/ui/tree

Default

A file tree — terse nodes with folder/file icons, a disabled node, default-expanded branches.

Project files
  • src
    • components
      • button.tsx
      • tree.tsx
    • index.ts
  • README.md
  • assets

Selection

Single-select navigation — one active node (aria-selected), selection following focus.

Navigation
  • src
    • components
      • button.tsx
      • tree.tsx
    • index.ts
  • README.md

Checkable

A checkbox tree — tri-state parent↔child cascade with indeterminate parents.

Select assets
  • assets
    • images
      • logo.svg
      • hero.png
      • icon.png

Sizes

The size ladder — sm · md · lg row geometry.

sm

sm
  • Documents
    • notes.md
  • report.pdf

md

md
  • Documents
    • notes.md
  • report.pdf

lg

lg
  • Documents
    • notes.md
  • report.pdf

Guides Actions

Indent guide lines, trailing badges, and per-node hover actions.

Team
  • Engineering12
  • Design4
    • Don Norman

Filter

Filter-to-reveal — Tree.Search hides non-matches, auto-expands ancestors, highlights.

Search files
  • README.md

Async

Async lazy children — a loadable node shows a spinner then loads its subtree on expand.

Remote files
  • local.txt

Multi Select

Multi-select — ⌘/Ctrl+A, Shift+Arrow range, PageUp/Down.

Select files (⌘A · Shift+↑↓ · PageUp/Down)
  • src
    • components
      • button.tsx
      • tree.tsx
      • input.tsx
    • index.ts
  • README.md

Rename

Inline rename — F2 / double-click swaps the label for an editable field.

Rename (F2 or double-click)
  • My files
    • Untitled.md
    • photo.png

Context Menu

Per-node right-click actions — a ContextMenu composed inside the item.

Right-click a node
  • src
    • app.tsx
    • utils.ts

Skeleton

A loading preset — indented chevron/icon/label placeholders.

Empty

An empty state via Tree.Empty composing <Empty>.

Files
  • No files yet

    Files you add to this project will show up here.

Reorderable

Drag-reparent — a grip handle per node; drag to move nodes between parents (3-way drop zones, cycle-safe), with onMove reshaping nested data.

Drag a handle to reparent
  • src
    • components
      • button.tsx
      • tree.tsx
    • index.ts
  • README.md
  • logo.svg