Skip to content
Eskais UI

Data

Tree

UI SDK Tree styled as indented rows with guide lines: a file explorer from paths with folder and file icons, checkable trees with mixed branches, lazy branches, links and a flat list for virtualizing.

Example

src
lib
format.ts
parse.ts
index.ts
package.json
README.md

Installation

npx shadcn@latest add @eskais/tree
Brings alonglink
npm packageslucide-react

Usage

Import
import {  Tree,  TreeGroup,  TreeItem,  TreeItemCheckbox,  TreeItemIndicator,  TreeItemLabel,  TreeNodes,  toggleTreeItem,  treeFileIcon,  createTreeController,  toggleTreeChecked,  treeCheckedStates,  treeFromPaths,  visibleTreeRows,} from "@/components/ui/tree"

Reach for it for nested items people expand and collapse: a file explorer, nested settings, a table of contents. For a flat list use List.

API reference

Tree

Takes TreeProps<Mode>.

TreeNodes

PropTypeDefault
itemsrequiredreadonly TreeItemData[]–
iconTreeIconResolver | falsetreeFileIcon
checkablebooleanfalse

Other exports

toggleTreeItemtreeFileIconcreateTreeControllertoggleTreeCheckedtreeCheckedStatestreeFromPathsvisibleTreeRowstype TreeIcontype TreeIconResolvertype TreeNodesPropstype TreePropstype TreeCheckStrategytype TreeCheckedStatetype TreeControllertype TreeItemDatatype TreeItemStatetype TreeModetype TreeRowtype TreeValue

Accessibility

  • The WAI-ARIA tree: one tab stop, arrows move and expand, Home/End, typeahead, * expands siblings.
  • Every row says its level and place among its siblings; checkable trees report mixed branches.
  • Icons are decorative; the label names each item.

Agent actions

Agents find the tree by its aria-label and expand, collapse, select or check items by value.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.