Give the Tree an aria-label, and give each TreeItem an id and a textValue. Type-ahead reads textValue.
file-tree.tsx
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 | — | |
| inert | boolean | — | |
| translate | "no""yes" | — | |
| suppress | 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. |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | UIEventHandler<HTMLDivElement> | — | |
| on | UIEventHandler<HTMLDivElement> | — | |
| on | WheelEventHandler<HTMLDivElement> | — | |
| on | WheelEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| selection | "multiple""none""single" | — | The type of selection that is allowed in the collection. |
| disallow | boolean | — | Whether the collection allows empty selection. |
| items | Iterable<T> | — | Item objects in the collection. |
| disabled | 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 | — | 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. |
| auto | "first""last"boolean | — | Whether to auto focus the gridlist or an option. |
| on | — | 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. | |
| should | boolean | — | Whether selection should occur on press up instead of press down. |
| keyboard | "arrow""tab" | 'arrow' | Whether keyboard navigation to focusable elements within grid list items is via the left/right arrow keys or the tab key. |
| escape | "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. |
| selection | "replace""toggle" | 'toggle' | How multiple selection should behave in the tree. |
| render | — | Provides content to display when there are no items in the list. | |
| disabled | "all""selection" | 'all' | Whether disabledKeys applies to all interactions, or only selection. |
| drag | 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). |
| default | "all" | Iterable<Key> | — | The picked keys at first (uncontrolled). |
| on | — | 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). |
| default | Iterable<Key> | — | The keys of the open rows at first (uncontrolled). |
| on | — | Runs when a row opens or closes, with the new open keys and the Base UI change details. | |
| class | 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. |
| selection | 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. |
| href | string | — | Hints at the human language of the linked URL. SeeMDN. |
| target | "_blank""_parent""_self""_top"string | — | 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. |
| referrer | """no-referrer""no-referrer-when-downgrade""origin""origin-when-cross-origin""same-origin""strict-origin""strict-origin-when-cross-origin""unsafe-url" | — | How much of the referrer to send when following the link. See MDN. |
| router | | — | Options for the configured client side router. |
| dir | string | — | |
| lang | string | — | |
| inert | boolean | — | |
| translate | "no""yes" | — | |
| suppress | 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. |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | UIEventHandler<HTMLDivElement> | — | |
| on | UIEventHandler<HTMLDivElement> | — | |
| on | WheelEventHandler<HTMLDivElement> | — | |
| on | WheelEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | — | Handler that is called when a hover interaction starts. | |
| on | — | Handler that is called when a hover interaction ends. | |
| on | — | Handler that is called when the hover state changes. | |
| on | — | Handler that is called when the press is released over the target. | |
| on | — | Handler that is called when a press interaction starts. | |
| on | — | Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. | |
| on | — | Handler that is called when the press state changes. | |
| on | — | Handler that is called when a press is released over the target, regardless of whether it started on the target or not. | |
| on | — | **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 | — | 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. | |
| has | boolean | — | Whether this item has children, even if not loaded yet. |
| focus | "child""row" | 'row' | Whether the row or its first focusable child element should be focused when the row is focused. |
| allows | 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. |
| text | 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. |
| on | — | 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. |
| class | 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 | — | 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
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
TreeItemMeta
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
TreeItemActions
<div>| 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. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
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. |
| exclude | 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 | — | |
| inert | boolean | — | |
| translate | "no""yes" | — | |
| suppress | 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. |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | MouseEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | TouchEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | PointerEventHandler<HTMLButtonElement> | — | |
| on | UIEventHandler<HTMLButtonElement> | — | |
| on | UIEventHandler<HTMLButtonElement> | — | |
| on | WheelEventHandler<HTMLButtonElement> | — | |
| on | WheelEventHandler<HTMLButtonElement> | — | |
| on | AnimationEventHandler<HTMLButtonElement> | — | |
| on | AnimationEventHandler<HTMLButtonElement> | — | |
| on | AnimationEventHandler<HTMLButtonElement> | — | |
| on | AnimationEventHandler<HTMLButtonElement> | — | |
| on | AnimationEventHandler<HTMLButtonElement> | — | |
| on | AnimationEventHandler<HTMLButtonElement> | — | |
| on | — | ||
| on | — | ||
| on | — | ||
| on | — | ||
| on | — | ||
| on | — | ||
| on | — | ||
| on | — | ||
| on | — | Handler that is called when a key is pressed. | |
| on | — | Handler that is called when a key is released. | |
| on | — | Handler that is called when the element receives focus. | |
| on | — | Handler that is called when the element loses focus. | |
| on | — | Handler that is called when the element's focus status changes. | |
| on | — | Handler that is called when a hover interaction starts. | |
| on | — | Handler that is called when a hover interaction ends. | |
| on | — | Handler that is called when the hover state changes. | |
| on | — | Handler that is called when the press is released over the target. | |
| on | — | Handler that is called when a press interaction starts. | |
| on | — | Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. | |
| on | — | Handler that is called when the press state changes. | |
| on | — | Handler that is called when a press is released over the target, regardless of whether it started on the target or not. | |
| on | — | **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. | |
| auto | 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 | — | 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 | — | 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 | — | 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. |
| prevent | 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. |
| form | — | The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner. | |
| form | string | — | Indicates how to encode the form data that is submitted. |
| form | string | — | Indicates the HTTP method used to submit the form. |
| form | boolean | — | Indicates that the form is not to be validated when it is submitted. |
| form | 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. |
| is | 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. |
| class | 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. |
| id | Key | — | A scope to prepend to all child item ids to ensure they are unique. |
| add | boolean | — | Whether to add id and value props to all child items. |
TreeSection
| Prop | Type | Default | Description |
|---|---|---|---|
| dir | string | — | |
| lang | string | — | |
| inert | boolean | — | |
| translate | "no""yes" | — | |
| suppress | 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. |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | UIEventHandler<HTMLElement> | — | |
| on | UIEventHandler<HTMLElement> | — | |
| on | WheelEventHandler<HTMLElement> | — | |
| on | WheelEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | 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 | — | Static child items or a function to render children. | |
| dependencies | readonly any[] | — | Values that should invalidate the item cache when using dynamic collections. |
| class | string | — | |
| ref | Ref<HTMLDivElement> | — | |
TreeHeader
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | — | The element's unique identifier. See MDN. |
| dir | string | — | |
| lang | string | — | |
| inert | boolean | — | |
| translate | "no""yes" | — | |
| suppress | 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. |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | MouseEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | TouchEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | PointerEventHandler<HTMLElement> | — | |
| on | UIEventHandler<HTMLElement> | — | |
| on | UIEventHandler<HTMLElement> | — | |
| on | WheelEventHandler<HTMLElement> | — | |
| on | WheelEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | AnimationEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | TransitionEventHandler<HTMLElement> | — | |
| on | 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. |
| class | string | — |
TreeItemPending
| Prop | Type | Default | Description |
|---|---|---|---|
| style | — | The inline style for the element. A function may be provided to compute the style based on component state. | |
| render | — | 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 |
|---|---|---|---|
| on | — | Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. | |
| style | — | The inline style for the element. A function may be provided to compute the style based on component state. | |
| render | — | 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. | |
| scroll | 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). |
| class | 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. |
| href | string | — | Hints at the human language of the linked URL. SeeMDN. |
| target | "_blank""_parent""_self""_top"string | — | 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. |
| referrer | """no-referrer""no-referrer-when-downgrade""origin""origin-when-cross-origin""same-origin""strict-origin""strict-origin-when-cross-origin""unsafe-url" | — | How much of the referrer to send when following the link. See MDN. |
| router | | — | Options for the configured client side router. |
| dir | string | — | |
| lang | string | — | |
| inert | boolean | — | |
| translate | "no""yes" | — | |
| suppress | 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. |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | MouseEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | TouchEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | PointerEventHandler<HTMLDivElement> | — | |
| on | UIEventHandler<HTMLDivElement> | — | |
| on | UIEventHandler<HTMLDivElement> | — | |
| on | WheelEventHandler<HTMLDivElement> | — | |
| on | WheelEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | AnimationEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | TransitionEventHandler<HTMLDivElement> | — | |
| on | — | Handler that is called when a hover interaction starts. | |
| on | — | Handler that is called when a hover interaction ends. | |
| on | — | Handler that is called when the hover state changes. | |
| on | — | Handler that is called when the press is released over the target. | |
| on | — | Handler that is called when a press interaction starts. | |
| on | — | Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. | |
| on | — | Handler that is called when the press state changes. | |
| on | — | Handler that is called when a press is released over the target, regardless of whether it started on the target or not. | |
| on | — | **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 | — | 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. |
| has | boolean | — | Whether this item has children, even if not loaded yet. |
| focus | "child""row" | 'row' | Whether the row or its first focusable child element should be focused when the row is focused. |
| allows | 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. |
| on | — | 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. | |
| class | 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
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
TreeDropIndicator
| Prop | Type | Default | Description |
|---|---|---|---|
| style | — | The inline style for the element. A function may be provided to compute the style based on component state. | |
| children | — | The children of the component. A function may be provided to alter the children based on component state. | |
| render | — | 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. |
| class | string | — | |
| ref | Ref<HTMLElement> | — | |
TreeDragPreview
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| count | number | 1 | How many rows move. A count Badge shows when it is more than 1. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
| Arrow DownorArrow 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. |
| HomeorEnd | Moves focus to the first or the last row. |
| Page UporPage 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. |
| Shiftarrow keys | Extends the selection, with selectionMode="multiple". |
| ⌘AorCtrlA | 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. |
Built with
Installs with Tree
- Components
- Badge,Button,Checkbox,Collapsible,Spinner





