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
routes
index.ts
public
tests
package.json
README.md
tree-demo.tsxCopy code
Installation
Copy code
Brings alonglink
npm packages
lucide-reactUsage
ImportCopy code
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>.
TreeItem
TreeItemLabel
TreeItemIndicator
TreeItemCheckbox
TreeGroup
TreeNodes
| Prop | Type | Default |
|---|---|---|
itemsrequired | readonly TreeItemData[] | – |
icon | TreeIconResolver | false | treeFileIcon |
checkable | boolean | false |
Other exports
toggleTreeItemtreeFileIconcreateTreeControllertoggleTreeCheckedtreeCheckedStatestreeFromPathsvisibleTreeRowstype TreeIcontype TreeIconResolvertype TreeNodesPropstype TreePropstype TreeCheckStrategytype TreeCheckedStatetype TreeControllertype TreeItemDatatype TreeItemStatetype TreeModetype TreeRowtype TreeValueAccessibility
- 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.