---
title: "Tree"
description: "Lets people browse and pick items in a hierarchy, such as files, docs pages, or categories. Arrow keys open and close rows, and rows can move by drag."
url: https://gelatinui.com/components/tree
markdown_url: https://gelatinui.com/components/tree.md
access: free
install: "npx shadcn@latest add @gelatin-ui/tree"
registry_item: https://gelatinui.com/r/tree.json
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Tree

> Lets people browse and pick items in a hierarchy, such as files, docs pages, or categories. Arrow keys open and close rows, and rows can move by drag.

Page: https://gelatinui.com/components/tree

## When to use it

Best for: Browse and pick in a hierarchy, such as files, docs pages, or categories, with selection and drag and drop.

- Use it to browse and pick in a hierarchy: files, docs navigation, categories.
- Use `selectionMode="multiple"` with `selectionCascade` when checks follow the folders.
- Use `TreeLoadMoreItem` to load rows later, and a `Virtualizer` around the Tree for long lists.
- Use `flat` for a list with no parent rows that keeps the Tree look.
- Use `TreeItemActions` for row buttons or a Menu that do not select the row.

## When not to use it

- For the main navigation of an app, use a [Sidebar](https://gelatinui.com/components/sidebar.md).
- To pick one form value through nested levels, use a [Cascader](https://gelatinui.com/components/cascader.md).
- For a plain list of label and value rows, use a [Data List](https://gelatinui.com/components/data-list.md).

## Notes for agents

- Give the Tree an `aria-label` or `aria-labelledby`.
- Give each `TreeItem` an `id` and a `textValue`. Type-ahead reads `textValue`.
- `onValueChange` always gets a Set. "Select all" arrives as every selectable key.
- A plain press on a parent row also opens it. With `selectionMode="multiple"` and `toggle`, the press checks the row and only the chevron opens it.
- A row with `hasChildItems` and no child rows yet needs a `TreeItemPending` child. Render it only until the rows arrive.
- Use `TreeItemCollection` for a live tree. Static `items.map` renders every row on every render of the tree.
- `TreeItemAction` needs an `aria-label`.
- Use `TreeEmptyItem` for a loaded folder with nothing in it, so people do not read it as still loading.

## Anatomy

```text
Tree
├─ TreeItem (0..n)
├─ TreeItemContent (0..n)
├─ TreeItemLabel (0..n)
├─ TreeItemMeta (0..n)
├─ TreeItemActions (0..n)
├─ TreeItemAction (0..n)
├─ TreeSection (0..n)
├─ TreeHeader (0..n)
├─ TreeItemPending (0..n)
├─ TreeLoadMoreItem (0..n)
├─ TreeEmptyItem (0..n)
├─ TreeEmpty (0..n)
├─ TreeDropIndicator (0..n)
└─ TreeDragPreview (0..n)
```

## API reference

### Tree

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` |  | Defines a string value that labels the current element. |
| `aria-labelledby` | `string` |  | Identifies the element (or elements) that labels the current element. |
| `aria-describedby` | `string` |  | Identifies the element (or elements) that describes the object. |
| `aria-details` | `string` |  | Identifies the element (or elements) that provide a detailed, extended description for the object. |
| `id` | `string` |  | The element's unique identifier. See MDN. |
| `dir` | `string` |  |  |
| `lang` | `string` |  |  |
| `hidden` | `boolean` |  |  |
| `inert` | `boolean` |  |  |
| `translate` | `"no" \| "yes"` |  |  |
| `suppressHydrationWarning` | `boolean` |  | A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs. |
| `onClick` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onAuxClick` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onAuxClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onContextMenu` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onContextMenuCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onDoubleClick` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onDoubleClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseDown` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseDownCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseEnter` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseLeave` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseMove` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseMoveCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOut` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOutCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOver` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOverCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseUp` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseUpCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onTouchCancel` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchCancelCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchEnd` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchEndCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchMove` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchMoveCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchStart` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchStartCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onPointerDown` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerDownCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerMove` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerMoveCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerUp` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerUpCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerCancel` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerCancelCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerEnter` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerLeave` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOver` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOverCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOut` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOutCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onGotPointerCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onGotPointerCaptureCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onLostPointerCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onLostPointerCaptureCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onScroll` | `UIEventHandler<HTMLDivElement>` |  |  |
| `onScrollCapture` | `UIEventHandler<HTMLDivElement>` |  |  |
| `onWheel` | `WheelEventHandler<HTMLDivElement>` |  |  |
| `onWheelCapture` | `WheelEventHandler<HTMLDivElement>` |  |  |
| `onAnimationStart` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationStartCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationEnd` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationEndCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationIteration` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationIterationCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onTransitionCancel` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionCancelCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionEnd` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionEndCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionRun` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionRunCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionStart` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionStartCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `selectionMode` | `SelectionMode` |  | The type of selection that is allowed in the collection. |
| `disallowEmptySelection` | `boolean` |  | Whether the collection allows empty selection. |
| `items` | `Iterable<T>` |  | Item objects in the collection. |
| `disabledKeys` | `Iterable<Key>` |  | The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with. |
| `style` | `StyleOrFunction<TreeRenderProps>` |  | The inline style for the element. A function may be provided to compute the style based on component state. |
| `slot` | `string \| null` |  | A slot name for the component. Slots allow the component to receive props from a parent component. An explicit `null` value indicates that the local props completely override all props received from a parent. |
| `render` | `DOMRenderFunction` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `children` | `((item: T) => ReactNode) \| ReactNode` |  | The contents of the collection. |
| `dependencies` | `readonly any[]` |  | Values that should invalidate the item cache when using dynamic collections. |
| `autoFocus` | `boolean \| FocusStrategy` |  | Whether to auto focus the gridlist or an option. |
| `onAction` | `function` |  | Handler that is called when a user performs an action on an item. The exact user event depends on the collection's `selectionBehavior` prop and the interaction modality. |
| `shouldSelectOnPressUp` | `boolean` |  | Whether selection should occur on press up instead of press down. |
| `keyboardNavigationBehavior` | `"arrow" \| "tab"` | 'arrow' | Whether keyboard navigation to focusable elements within grid list items is via the left/right arrow keys or the tab key. |
| `escapeKeyBehavior` | `"clearSelection" \| "none"` | 'clearSelection' | Whether pressing the escape key should clear selection in the grid list or not. Most experiences should not modify this option as it eliminates a keyboard user's ability to easily clear selection. Only use if the escape key is being handled externally or should not trigger selection clearing contextually. |
| `selectionBehavior` | `SelectionBehavior` | 'toggle' | How multiple selection should behave in the tree. |
| `renderEmptyState` | `function` |  | Provides content to display when there are no items in the list. |
| `disabledBehavior` | `DisabledBehavior` | 'all' | Whether `disabledKeys` applies to all interactions, or only selection. |
| `dragAndDropHooks` | `DragAndDropHooks<NoInfer<T>>` |  | The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the Tree. |
| `value` | `"all" \| Iterable<Key>` |  | The picked keys (controlled). |
| `defaultValue` | `"all" \| Iterable<Key>` |  | The picked keys at first (uncontrolled). |
| `onValueChange` | `function` |  | Runs on each change, with the new picked keys and the Base UI change details. |
| `expanded` | `Iterable<Key>` |  | The keys of the open rows (controlled). |
| `defaultExpanded` | `Iterable<Key>` |  | The keys of the open rows at first (uncontrolled). |
| `onExpandedChange` | `function` |  | Runs when a row opens or closes, with the new open keys and the Base UI change details. |
| `className` | `string` |  |  |
| `ref` | `Ref<HTMLDivElement>` |  |  |
| `guides` | `boolean` | true | Draw a 1px line under the chevron of each ancestor level. Default `true`: deep trees keep the level readable. Turn it off for a short nav tree. |
| `flat` | `boolean` | false | A list with no parent rows: no row keeps the 20px chevron lane (and its 6px gap) empty, so the icon of each row sits at the row padding. For a flat list of the Tree look (the list view of Changed Files). A row with child rows still shows its chevron. Default `false`. |
| `selectionCascade` | `boolean` | false | Checks follow the folders (`selectionMode="multiple"`): checking a row checks every row under it, also in closed folders and at every depth; unchecking clears them; a parent is checked when all its rows are, and shows the dash when some are. Disabled rows are skipped, and a disabled folder shows the state of its rows. Rows that load or drop into a folder the user checked arrive checked, unless the user unchecked that exact row (`#/lib/tree-selection-model`, `TreeCheckIntent`). `onValueChange` gets the whole result, so a controlled `value` works. It runs on a user change, and when rows load into a checked folder; never on the mount or a render of the parent (there the Tree only draws the whole selection). Default `false`: React Aria's independent selection, where a folder is an item of its own. |

### TreeItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `href` | `string` |  | A URL to link to. See MDN. |
| `hrefLang` | `string` |  | Hints at the human language of the linked URL. SeeMDN. |
| `target` | `HTMLAttributeAnchorTarget` |  | The target window for the link. See MDN. |
| `rel` | `string` |  | The relationship between the linked resource and the current page. See MDN. |
| `download` | `string \| boolean` |  | Causes the browser to download the linked URL. A string may be provided to suggest a file name. See MDN. |
| `ping` | `string` |  | A space-separated list of URLs to ping when the link is followed. See MDN. |
| `referrerPolicy` | `HTMLAttributeReferrerPolicy` |  | How much of the referrer to send when following the link. See MDN. |
| `routerOptions` | `` |  | Options for the configured client side router. |
| `dir` | `string` |  |  |
| `lang` | `string` |  |  |
| `hidden` | `boolean` |  |  |
| `inert` | `boolean` |  |  |
| `translate` | `"no" \| "yes"` |  |  |
| `suppressHydrationWarning` | `boolean` |  | A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs. |
| `onClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onAuxClick` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onAuxClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onContextMenu` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onContextMenuCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onDoubleClick` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onDoubleClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseDown` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseDownCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseEnter` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseLeave` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseMove` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseMoveCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOut` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOutCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOver` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOverCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseUp` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseUpCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onTouchCancel` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchCancelCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchEnd` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchEndCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchMove` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchMoveCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchStart` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchStartCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onPointerDown` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerDownCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerMove` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerMoveCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerUp` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerUpCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerCancel` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerCancelCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerEnter` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerLeave` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOver` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOverCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOut` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOutCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onGotPointerCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onGotPointerCaptureCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onLostPointerCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onLostPointerCaptureCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onScroll` | `UIEventHandler<HTMLDivElement>` |  |  |
| `onScrollCapture` | `UIEventHandler<HTMLDivElement>` |  |  |
| `onWheel` | `WheelEventHandler<HTMLDivElement>` |  |  |
| `onWheelCapture` | `WheelEventHandler<HTMLDivElement>` |  |  |
| `onAnimationStart` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationStartCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationEnd` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationEndCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationIteration` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationIterationCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onTransitionCancel` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionCancelCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionEnd` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionEndCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionRun` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionRunCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionStart` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionStartCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onHoverStart` | `function` |  | Handler that is called when a hover interaction starts. |
| `onHoverEnd` | `function` |  | Handler that is called when a hover interaction ends. |
| `onHoverChange` | `function` |  | Handler that is called when the hover state changes. |
| `onPress` | `function` |  | Handler that is called when the press is released over the target. |
| `onPressStart` | `function` |  | Handler that is called when a press interaction starts. |
| `onPressEnd` | `function` |  | Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. |
| `onPressChange` | `function` |  | Handler that is called when the press state changes. |
| `onPressUp` | `function` |  | Handler that is called when a press is released over the target, regardless of whether it started on the target or not. |
| `onClick` | `function` |  | **Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress` provided for compatibility with other libraries. `onPress` provides additional event details for non-mouse interactions. |
| `style` | `StyleOrFunction<TreeItemRenderProps>` |  | The inline style for the element. A function may be provided to compute the style based on component state. |
| `render` | `DOMRenderFunction` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `hasChildItems` | `boolean` |  | Whether this item has children, even if not loaded yet. |
| `focusMode` | `"child" \| "row"` | 'row' | Whether the row or its first focusable child element should be focused when the row is focused. |
| `allowsArrowNavigation` | `boolean` |  | Whether the row should support arrow key navigation even when the containing collection uses tab keyboard navigation. Allows users to navigate between rows with arrow keys while focus is on an interactive child element within the row. |
| `id` | `Key` |  | The unique id of the tree row. |
| `value` | `T` |  | The object value that this tree item represents. When using dynamic collections, this is set automatically. |
| `textValue` | `string` |  | A string representation of the tree item's contents, used for features like typeahead. |
| `aria-label` | `string` |  | An accessibility label for this tree item. |
| `children` | `ReactNode` |  | The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. |
| `onAction` | `function` |  | Handler that is called when a user performs an action on this tree item. The exact user event depends on the collection's `selectionBehavior` prop and the interaction modality. |
| `disabled` | `boolean` |  | Turns off the control: no focus, no edits, and the disabled look. |
| `className` | `string` |  |  |
| `ref` | `Ref<HTMLDivElement>` |  |  |
| `current` | `boolean` | false | The page this row links to is the current page: `aria-current="page"` and the raised chip. |
| `indeterminate` | `boolean` | false | The row's checkbox shows a dash: some of its children are checked. |

### TreeItemContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `function \| ReactNode` |  | The row content after the built-in lanes: an icon, `TreeItemLabel`, meta, and actions. A function gets the React Aria row state (`isExpanded` for an open folder icon, `isSelected`). |

### TreeItemLabel

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TreeItemMeta

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TreeItemActions

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `persistent` | `boolean` | false | Always show the actions, not only on hover, selection, or focus: for an action that is the point of the row now (the Answer of a Subagent Tree row whose agent waits for a person). Default false. |

### TreeItemAction

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` |  | Defines a string value that labels the current element. |
| `aria-labelledby` | `string` |  | Identifies the element (or elements) that labels the current element. |
| `aria-describedby` | `string` |  | Identifies the element (or elements) that describes the object. |
| `aria-details` | `string` |  | Identifies the element (or elements) that provide a detailed, extended description for the object. |
| `id` | `string` |  | The element's unique identifier. See MDN. |
| `excludeFromTabOrder` | `boolean` |  | Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available. |
| `dir` | `string` |  |  |
| `lang` | `string` |  |  |
| `hidden` | `boolean` |  |  |
| `inert` | `boolean` |  |  |
| `translate` | `"no" \| "yes"` |  |  |
| `suppressHydrationWarning` | `boolean` |  | A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs. |
| `onClickCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onAuxClick` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onAuxClickCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onContextMenu` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onContextMenuCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onDoubleClick` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onDoubleClickCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseDown` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseDownCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseEnter` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseLeave` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseMove` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseMoveCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseOut` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseOutCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseOver` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseOverCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseUp` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onMouseUpCapture` | `MouseEventHandler<HTMLButtonElement>` |  |  |
| `onTouchCancel` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onTouchCancelCapture` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onTouchEnd` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onTouchEndCapture` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onTouchMove` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onTouchMoveCapture` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onTouchStart` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onTouchStartCapture` | `TouchEventHandler<HTMLButtonElement>` |  |  |
| `onPointerDown` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerDownCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerMove` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerMoveCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerUp` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerUpCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerCancel` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerCancelCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerEnter` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerLeave` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerOver` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerOverCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerOut` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onPointerOutCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onGotPointerCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onGotPointerCaptureCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onLostPointerCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onLostPointerCaptureCapture` | `PointerEventHandler<HTMLButtonElement>` |  |  |
| `onScroll` | `UIEventHandler<HTMLButtonElement>` |  |  |
| `onScrollCapture` | `UIEventHandler<HTMLButtonElement>` |  |  |
| `onWheel` | `WheelEventHandler<HTMLButtonElement>` |  |  |
| `onWheelCapture` | `WheelEventHandler<HTMLButtonElement>` |  |  |
| `onAnimationStart` | `AnimationEventHandler<HTMLButtonElement>` |  |  |
| `onAnimationStartCapture` | `AnimationEventHandler<HTMLButtonElement>` |  |  |
| `onAnimationEnd` | `AnimationEventHandler<HTMLButtonElement>` |  |  |
| `onAnimationEndCapture` | `AnimationEventHandler<HTMLButtonElement>` |  |  |
| `onAnimationIteration` | `AnimationEventHandler<HTMLButtonElement>` |  |  |
| `onAnimationIterationCapture` | `AnimationEventHandler<HTMLButtonElement>` |  |  |
| `onTransitionCancel` | `TransitionEventHandler` |  |  |
| `onTransitionCancelCapture` | `TransitionEventHandler` |  |  |
| `onTransitionEnd` | `TransitionEventHandler` |  |  |
| `onTransitionEndCapture` | `TransitionEventHandler` |  |  |
| `onTransitionRun` | `TransitionEventHandler` |  |  |
| `onTransitionRunCapture` | `TransitionEventHandler` |  |  |
| `onTransitionStart` | `TransitionEventHandler` |  |  |
| `onTransitionStartCapture` | `TransitionEventHandler` |  |  |
| `onKeyDown` | `function` |  | Handler that is called when a key is pressed. |
| `onKeyUp` | `function` |  | Handler that is called when a key is released. |
| `onFocus` | `function` |  | Handler that is called when the element receives focus. |
| `onBlur` | `function` |  | Handler that is called when the element loses focus. |
| `onFocusChange` | `function` |  | Handler that is called when the element's focus status changes. |
| `onHoverStart` | `function` |  | Handler that is called when a hover interaction starts. |
| `onHoverEnd` | `function` |  | Handler that is called when a hover interaction ends. |
| `onHoverChange` | `function` |  | Handler that is called when the hover state changes. |
| `onPress` | `function` |  | Handler that is called when the press is released over the target. |
| `onPressStart` | `function` |  | Handler that is called when a press interaction starts. |
| `onPressEnd` | `function` |  | Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. |
| `onPressChange` | `function` |  | Handler that is called when the press state changes. |
| `onPressUp` | `function` |  | Handler that is called when a press is released over the target, regardless of whether it started on the target or not. |
| `onClick` | `function` |  | **Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress` provided for compatibility with other libraries. `onPress` provides additional event details for non-mouse interactions. |
| `autoFocus` | `boolean` |  | Whether the element should receive focus on render. |
| `style` | `StyleOrFunction<ButtonRenderProps>` |  | The inline style for the element. A function may be provided to compute the style based on component state. |
| `children` | `ChildrenOrFunction<ButtonRenderProps>` |  | The children of the component. A function may be provided to alter the children based on component state. |
| `slot` | `string \| null` |  | A slot name for the component. Slots allow the component to receive props from a parent component. An explicit `null` value indicates that the local props completely override all props received from a parent. |
| `render` | `DOMRenderFunction` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `aria-disabled` | `"false" \| "true" \| boolean` |  | Indicates whether the element is disabled to users of assistive technology. |
| `aria-expanded` | `"false" \| "true" \| boolean` |  | Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. |
| `aria-haspopup` | `union` |  | Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. |
| `aria-controls` | `string` |  | Identifies the element (or elements) whose contents or presence are controlled by the current element. |
| `aria-pressed` | `"false" \| "mixed" \| "true" \| boolean` |  | Indicates the current "pressed" state of toggle buttons. |
| `aria-current` | `union` |  | Indicates whether this element represents the current item within a container or set of related elements. |
| `type` | `"button" \| "reset" \| "submit"` | 'button' | The behavior of the button when used in an HTML form. |
| `preventFocusOnPress` | `boolean` |  | Whether to prevent focus from moving to the button when pressing it. Caution, this can make the button inaccessible and should only be used when alternative keyboard interaction is provided, such as ComboBox's MenuTrigger or a NumberField's increment/decrement control. |
| `form` | `string` |  | The `<form>` element to associate the button with. The value of this attribute must be the id of a `<form>` in the same document. See MDN. |
| `formAction` | `string \| function` |  | The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner. |
| `formEncType` | `string` |  | Indicates how to encode the form data that is submitted. |
| `formMethod` | `string` |  | Indicates the HTTP method used to submit the form. |
| `formNoValidate` | `boolean` |  | Indicates that the form is not to be validated when it is submitted. |
| `formTarget` | `string` |  | Overrides the target attribute of the button's form owner. |
| `name` | `string` |  | Submitted as a pair with the button's value as part of the form data. |
| `value` | `string` |  | The value associated with the button's name when it's submitted with the form data. |
| `isPending` | `boolean` |  | Whether the button is in a pending state. This disables press and hover events while retaining focusability, and announces the pending state to screen readers. |
| `disabled` | `boolean` |  | Turns off the control: no focus, no edits, and the disabled look. |
| `className` | `string` |  |  |
| `ref` | `Ref<HTMLButtonElement>` |  |  |

### TreeItemCollection

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `Iterable<T>` |  | Item objects in the collection. |
| `children` | `((item: T) => ReactNode) \| ReactNode` |  | The contents of the collection. |
| `dependencies` | `readonly any[]` |  | Values that should invalidate the item cache when using dynamic collections. |
| `idScope` | `Key` |  | A scope to prepend to all child item ids to ensure they are unique. |
| `addIdAndValue` | `boolean` |  | Whether to add `id` and `value` props to all child items. |

### TreeSection

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `dir` | `string` |  |  |
| `lang` | `string` |  |  |
| `hidden` | `boolean` |  |  |
| `inert` | `boolean` |  |  |
| `translate` | `"no" \| "yes"` |  |  |
| `suppressHydrationWarning` | `boolean` |  | A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs. |
| `onClick` | `MouseEventHandler<HTMLElement>` |  |  |
| `onClickCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onAuxClick` | `MouseEventHandler<HTMLElement>` |  |  |
| `onAuxClickCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onContextMenu` | `MouseEventHandler<HTMLElement>` |  |  |
| `onContextMenuCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onDoubleClick` | `MouseEventHandler<HTMLElement>` |  |  |
| `onDoubleClickCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseDown` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseDownCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseEnter` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseLeave` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseMove` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseMoveCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOut` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOutCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOver` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOverCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseUp` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseUpCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onTouchCancel` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchCancelCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchEnd` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchEndCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchMove` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchMoveCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchStart` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchStartCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onPointerDown` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerDownCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerMove` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerMoveCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerUp` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerUpCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerCancel` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerCancelCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerEnter` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerLeave` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOver` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOverCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOut` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOutCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onGotPointerCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onGotPointerCaptureCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onLostPointerCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onLostPointerCaptureCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onScroll` | `UIEventHandler<HTMLElement>` |  |  |
| `onScrollCapture` | `UIEventHandler<HTMLElement>` |  |  |
| `onWheel` | `WheelEventHandler<HTMLElement>` |  |  |
| `onWheelCapture` | `WheelEventHandler<HTMLElement>` |  |  |
| `onAnimationStart` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationStartCapture` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationEnd` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationEndCapture` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationIteration` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationIterationCapture` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onTransitionCancel` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionCancelCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionEnd` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionEndCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionRun` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionRunCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionStart` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionStartCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `aria-label` | `string` |  | An accessibility label for the section. |
| `items` | `Iterable<T>` |  | Item objects in the section. |
| `style` | `CSSProperties` |  | The inline style for the element. |
| `render` | `DOMRenderFunction<"div", undefined>` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `id` | `Key` |  | The unique id of the section. |
| `value` | `T` |  | The object value that this section represents. When using dynamic collections, this is set automatically. |
| `children` | `function \| ReactNode` |  | Static child items or a function to render children. |
| `dependencies` | `readonly any[]` |  | Values that should invalidate the item cache when using dynamic collections. |
| `className` | `string` |  |  |
| `ref` | `Ref<HTMLDivElement>` |  |  |

### TreeHeader

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` |  | The element's unique identifier. See MDN. |
| `dir` | `string` |  |  |
| `lang` | `string` |  |  |
| `hidden` | `boolean` |  |  |
| `inert` | `boolean` |  |  |
| `translate` | `"no" \| "yes"` |  |  |
| `suppressHydrationWarning` | `boolean` |  | A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs. |
| `onClick` | `MouseEventHandler<HTMLElement>` |  |  |
| `onClickCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onAuxClick` | `MouseEventHandler<HTMLElement>` |  |  |
| `onAuxClickCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onContextMenu` | `MouseEventHandler<HTMLElement>` |  |  |
| `onContextMenuCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onDoubleClick` | `MouseEventHandler<HTMLElement>` |  |  |
| `onDoubleClickCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseDown` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseDownCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseEnter` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseLeave` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseMove` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseMoveCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOut` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOutCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOver` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseOverCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseUp` | `MouseEventHandler<HTMLElement>` |  |  |
| `onMouseUpCapture` | `MouseEventHandler<HTMLElement>` |  |  |
| `onTouchCancel` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchCancelCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchEnd` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchEndCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchMove` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchMoveCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchStart` | `TouchEventHandler<HTMLElement>` |  |  |
| `onTouchStartCapture` | `TouchEventHandler<HTMLElement>` |  |  |
| `onPointerDown` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerDownCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerMove` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerMoveCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerUp` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerUpCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerCancel` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerCancelCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerEnter` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerLeave` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOver` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOverCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOut` | `PointerEventHandler<HTMLElement>` |  |  |
| `onPointerOutCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onGotPointerCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onGotPointerCaptureCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onLostPointerCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onLostPointerCaptureCapture` | `PointerEventHandler<HTMLElement>` |  |  |
| `onScroll` | `UIEventHandler<HTMLElement>` |  |  |
| `onScrollCapture` | `UIEventHandler<HTMLElement>` |  |  |
| `onWheel` | `WheelEventHandler<HTMLElement>` |  |  |
| `onWheelCapture` | `WheelEventHandler<HTMLElement>` |  |  |
| `onAnimationStart` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationStartCapture` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationEnd` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationEndCapture` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationIteration` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onAnimationIterationCapture` | `AnimationEventHandler<HTMLElement>` |  |  |
| `onTransitionCancel` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionCancelCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionEnd` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionEndCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionRun` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionRunCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionStart` | `TransitionEventHandler<HTMLElement>` |  |  |
| `onTransitionStartCapture` | `TransitionEventHandler<HTMLElement>` |  |  |
| `style` | `CSSProperties` |  | The inline style for the element. |
| `children` | `ReactNode` |  | The children of the component. |
| `render` | `DOMRenderFunction<"div", undefined>` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `className` | `string` |  |  |

### TreeItemPending

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `style` | `StyleOrFunction` |  | The inline style for the element. A function may be provided to compute the style based on component state. |
| `render` | `DOMRenderFunction` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |

### TreeLoadMoreItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onLoadMore` | `function` |  | Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. |
| `style` | `StyleOrFunction` |  | The inline style for the element. A function may be provided to compute the style based on component state. |
| `render` | `DOMRenderFunction` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `scrollOffset` | `number` | 1 | The amount of offset from the bottom of your scrollable region that should trigger load more. Uses a percentage value relative to the scroll body's client height. Load more is then triggered when your current scroll position's distance from the bottom of the currently loaded list of items is less than or equal to the provided value. (e.g. 1 = 100% of the scroll region's height). |
| `className` | `string` |  |  |
| `ref` | `Ref<HTMLDivElement>` |  |  |
| `busy` | `boolean` |  | More rows load: the row shows (React Aria `isLoading`). |
| `children` | `string` | "Loading…" | The text of the row. Default: "Loading…". Translate it. |

### TreeEmptyItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `href` | `string` |  | A URL to link to. See MDN. |
| `hrefLang` | `string` |  | Hints at the human language of the linked URL. SeeMDN. |
| `target` | `HTMLAttributeAnchorTarget` |  | The target window for the link. See MDN. |
| `rel` | `string` |  | The relationship between the linked resource and the current page. See MDN. |
| `download` | `string \| boolean` |  | Causes the browser to download the linked URL. A string may be provided to suggest a file name. See MDN. |
| `ping` | `string` |  | A space-separated list of URLs to ping when the link is followed. See MDN. |
| `referrerPolicy` | `HTMLAttributeReferrerPolicy` |  | How much of the referrer to send when following the link. See MDN. |
| `routerOptions` | `` |  | Options for the configured client side router. |
| `dir` | `string` |  |  |
| `lang` | `string` |  |  |
| `hidden` | `boolean` |  |  |
| `inert` | `boolean` |  |  |
| `translate` | `"no" \| "yes"` |  |  |
| `suppressHydrationWarning` | `boolean` |  | A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs. |
| `onClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onAuxClick` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onAuxClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onContextMenu` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onContextMenuCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onDoubleClick` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onDoubleClickCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseDown` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseDownCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseEnter` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseLeave` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseMove` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseMoveCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOut` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOutCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOver` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseOverCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseUp` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onMouseUpCapture` | `MouseEventHandler<HTMLDivElement>` |  |  |
| `onTouchCancel` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchCancelCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchEnd` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchEndCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchMove` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchMoveCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchStart` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onTouchStartCapture` | `TouchEventHandler<HTMLDivElement>` |  |  |
| `onPointerDown` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerDownCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerMove` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerMoveCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerUp` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerUpCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerCancel` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerCancelCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerEnter` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerLeave` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOver` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOverCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOut` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onPointerOutCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onGotPointerCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onGotPointerCaptureCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onLostPointerCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onLostPointerCaptureCapture` | `PointerEventHandler<HTMLDivElement>` |  |  |
| `onScroll` | `UIEventHandler<HTMLDivElement>` |  |  |
| `onScrollCapture` | `UIEventHandler<HTMLDivElement>` |  |  |
| `onWheel` | `WheelEventHandler<HTMLDivElement>` |  |  |
| `onWheelCapture` | `WheelEventHandler<HTMLDivElement>` |  |  |
| `onAnimationStart` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationStartCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationEnd` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationEndCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationIteration` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onAnimationIterationCapture` | `AnimationEventHandler<HTMLDivElement>` |  |  |
| `onTransitionCancel` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionCancelCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionEnd` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionEndCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionRun` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionRunCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionStart` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onTransitionStartCapture` | `TransitionEventHandler<HTMLDivElement>` |  |  |
| `onHoverStart` | `function` |  | Handler that is called when a hover interaction starts. |
| `onHoverEnd` | `function` |  | Handler that is called when a hover interaction ends. |
| `onHoverChange` | `function` |  | Handler that is called when the hover state changes. |
| `onPress` | `function` |  | Handler that is called when the press is released over the target. |
| `onPressStart` | `function` |  | Handler that is called when a press interaction starts. |
| `onPressEnd` | `function` |  | Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. |
| `onPressChange` | `function` |  | Handler that is called when the press state changes. |
| `onPressUp` | `function` |  | Handler that is called when a press is released over the target, regardless of whether it started on the target or not. |
| `onClick` | `function` |  | **Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress` provided for compatibility with other libraries. `onPress` provides additional event details for non-mouse interactions. |
| `style` | `StyleOrFunction<TreeItemRenderProps>` |  | The inline style for the element. A function may be provided to compute the style based on component state. |
| `render` | `DOMRenderFunction` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `disabled` | `boolean` |  | Turns off the control: no focus, no edits, and the disabled look. |
| `hasChildItems` | `boolean` |  | Whether this item has children, even if not loaded yet. |
| `focusMode` | `"child" \| "row"` | 'row' | Whether the row or its first focusable child element should be focused when the row is focused. |
| `allowsArrowNavigation` | `boolean` |  | Whether the row should support arrow key navigation even when the containing collection uses tab keyboard navigation. Allows users to navigate between rows with arrow keys while focus is on an interactive child element within the row. |
| `id` | `Key` |  | The unique id of the tree row. |
| `value` | `object` |  | The object value that this tree item represents. When using dynamic collections, this is set automatically. |
| `aria-label` | `string` |  | An accessibility label for this tree item. |
| `onAction` | `function` |  | Handler that is called when a user performs an action on this tree item. The exact user event depends on the collection's `selectionBehavior` prop and the interaction modality. |
| `className` | `string` |  |  |
| `ref` | `Ref<HTMLDivElement>` |  |  |
| `current` | `boolean` |  | The page this row links to is the current page: `aria-current="page"` and the raised chip. |
| `indeterminate` | `boolean` |  | The row's checkbox shows a dash: some of its children are checked. |
| `children` | `string` | "Empty" | Default: "Empty". Translate it. |

### TreeEmpty

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TreeDropIndicator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `style` | `StyleOrFunction` |  | The inline style for the element. A function may be provided to compute the style based on component state. |
| `children` | `ChildrenOrFunction` |  | The children of the component. A function may be provided to alter the children based on component state. |
| `render` | `DOMRenderFunction` |  | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| `target` | `DropTarget` |  | The drop target that the drop indicator represents. |
| `className` | `string` |  |  |
| `ref` | `Ref<HTMLElement>` |  |  |

### TreeDragPreview

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `count` | `number` | 1 | How many rows move. A count Badge shows when it is more than 1. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Tree | `tree` | `data-draggable`, `data-drop-target`, `data-focus-visible` | `--spacing`, `--tree-chevron-lane`, `--tree-drag-lane`, `--tree-indent-step` |  |
| TreeItem | `tree-item` | `data-active`, `data-disabled`, `data-dragging`, `data-drop-target`, `data-focus-visible`, `data-hovered`, `data-icon`, `data-pressed`, `data-selected` |  | `hit-area` |
| TreeItemContent | `tree-item-bar` | `data-disabled`, `data-focus-visible`, `data-focus-visible-within`, `data-hovered`, `data-join-after`, `data-join-before`, `data-selected` | `--tree-chevron-lane` | `motion-timing` |
| TreeItemLabel | `tree-item-label` |  |  |  |
| TreeItemMeta | `tree-item-meta` | `data-selected` |  |  |
| TreeItemActions | `tree-item-actions` | `data-active`, `data-focus-visible`, `data-hovered`, `data-persistent`, `data-selected` |  | `motion-timing` |
| TreeItemAction | `tree-item-action` | `data-focus-visible` | `--radius-sm` |  |
| TreeSection | `tree-section` |  |  |  |
| TreeHeader | `tree-header` |  |  |  |
| TreeItemPending | `tree-item-pending` |  |  |  |
| TreeLoadMoreItem | `tree-load-more-item` |  | `--spacing`, `--tree-chevron-lane`, `--tree-drag-lane`, `--tree-indent-step`, `--tree-item-level`, `--tree-row-start` |  |
| TreeEmptyItem | `tree-empty-item` | `data-disabled` |  |  |
| TreeEmpty | `tree-empty` |  |  |  |
| TreeDropIndicator | `tree-drop-indicator` | `data-drop-target` | `--spacing`, `--tree-chevron-lane`, `--tree-drag-lane`, `--tree-indent-step`, `--tree-item-level`, `--tree-row-start` |  |
| TreeDragPreview | `tree-drag-preview` | `data-icon` |  |  |

## Usage

Give the Tree an `aria-label`, and give each `TreeItem` an `id` and a `textValue`. Type-ahead reads `textValue`.

```tsx title="file-tree.tsx"
import { Tree, TreeItem, TreeItemContent, TreeItemLabel } from "@/components/ui/tree";

export function FileTree() {
  return (
    <Tree aria-label="Files" defaultExpanded={["src"]} selectionMode="single">
      <TreeItem id="src" textValue="src">
        <TreeItemContent>
          <TreeItemLabel>src</TreeItemLabel>
        </TreeItemContent>
        <TreeItem id="app" textValue="app.tsx">
          <TreeItemContent>
            <TreeItemLabel>app.tsx</TreeItemLabel>
          </TreeItemContent>
        </TreeItem>
      </TreeItem>
    </Tree>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/tree
```

It adds 35 registry items: 32 files, 5992 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `clsx`, `motion`, `react-aria-components`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Badge](https://gelatinui.com/components/badge.md)
- [Button](https://gelatinui.com/components/button.md)
- [Checkbox](https://gelatinui.com/components/checkbox.md)
- [Collapsible](https://gelatinui.com/components/collapsible.md)
- [Spinner](https://gelatinui.com/components/spinner.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Sidebar](https://gelatinui.com/components/sidebar.md)
- [Menu](https://gelatinui.com/components/menu.md)
- [Checkbox](https://gelatinui.com/components/checkbox.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Arrow Down, Arrow Up | Moves focus to the next or the previous row. |
| Arrow Right | Opens a closed parent row. In right to left, use Arrow Left. |
| Arrow Left | Closes an open parent row. On another row, it moves focus to the parent. In right to left, use Arrow Right. |
| Home, End | Moves focus to the first or the last row. |
| Page Up, Page Down | Moves focus by one page of rows. |
| Space | Selects or checks the row that has focus, when selection is on. |
| Enter | Runs `onAction` on the row, when the tree has one. |
| Shift + arrow keys | Extends the selection, with `selectionMode="multiple"`. |
| ⌘A, Ctrl+A | Selects all rows, with `selectionMode="multiple"`. |
| Escape | Clears the selection. In checkbox mode it does nothing, unless you set `escapeKeyBehavior`. |
| Letter keys | Moves focus to the next row whose name starts with the typed letters. |
| Enter | On the drag handle: starts a keyboard drag. Tab moves between drop targets, Enter drops, and Escape cancels. |

## Accessibility

It is a React Aria Tree with the `treegrid` role. Focus moves between rows with the arrow keys.

`TreeItemAction` needs an `aria-label`, because it shows only an icon.

On a touch screen rows are 44px high, and the actions always show.

## Motion

| Part | Motion |
| --- | --- |
| Row hover | hover · 150ms · ease-out (0, 0, 0.2, 1) |
