Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Tree View for Ark UI

A tree of folders and files that people walk with the arrow keys, with selection, checkboxes, renaming and lazy loading, for React and Ark UI projects.

On this page9 sections

A tree view shows a hierarchy that people move through and act on: the files of a project, the pages of a docs site, the folders of a mail client. The whole tree is one Tab stop, the arrow keys walk and open its rows, and a row can be selected, checked, renamed or followed as a link.

For one section that shows and hides, a Collapsible is enough, and a flat list of sections reads better as an Accordion.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Tree View anatomy: branch, branch indicator, branch item, branch content, item

Usage

import {
  createTreeCollection, TreeView, TreeViewBranch, TreeViewBranchContent,
  TreeViewBranchItem, TreeViewContent, TreeViewItem, TreeViewNode,
  TreeViewTree,
} from "@/components/ui/tree-view";

The tree reads its nodes from a collection. Each node's id is the value that selection and expansion report, and its name is the label that typing a letter searches. TreeNode renders itself again for a folder's children, so the same component draws any depth.

const TreeViewDemo = () => (
  <div className="w-full max-w-48">
    <TreeView collection={collection}>
      <TreeViewTree>
        {collection.rootNode.children?.map((node, index) => (
          <TreeNode indexPath={[index]} key={node.id} node={node} />
        ))}
      </TreeViewTree>
    </TreeView>
  </div>
);

const collection = createTreeCollection({
  rootNode: {
    id: "ROOT",
    name: "",
    children: [
      {
        id: "app",
        name: "app",
        children: [
          { id: "app/page.tsx", name: "page.tsx" },
          { id: "app/layout.tsx", name: "layout.tsx" },
        ],
      },
      {
        id: "components",
        name: "components",
        children: [
          { id: "components/button.tsx", name: "button.tsx" },
          { id: "components/input.tsx", name: "input.tsx" },
        ],
      },
      { id: "package.json", name: "package.json" },
      { id: "readme.md", name: "README.md" },
    ],
  },
});

const TreeNode = (props: React.ComponentProps<typeof TreeViewNode>) => {
  const { node, indexPath, ...rest } = props;

  return (
    <TreeViewNode indexPath={indexPath} node={node} {...rest}>
      {node.children ? (
        <TreeViewBranch>
          <TreeViewBranchItem>{node.name}</TreeViewBranchItem>

          <TreeViewBranchContent>
            {node.children.map((child, index) => (
              <TreeNode
                indexPath={[...indexPath, index]}
                key={child.id}
                node={child}
              />
            ))}
          </TreeViewBranchContent>
        </TreeViewBranch>
      ) : (
        <TreeViewContent>
          <TreeViewItem>{node.name}</TreeViewItem>
        </TreeViewContent>
      )}
    </TreeViewNode>
  );
};

Accessibility

TreeViewTree has the tree role and every node is a treeitem that reports its level and whether it is selected, and for a folder, whether it is open. Only the focused row is in the tab order. Name the tree with TreeViewLabel, as the Links demo does: without one, a screen reader announces it as Tree View. Shift with the arrow keys extends the selection only when selectionMode is multiple. The checkboxes in the Checkbox tree demo stay out of the tab order, and Space on a row checks or unchecks its box.

Tab
Moves focus to the tree view, placing the first tree view item in focus.
Enter
Selects the item or branch node.
Space
Selects the item or branch node. On a row with a checkbox, checks or unchecks it instead.
Arrow Down
Moves focus to the next node.
Arrow Up
Moves focus to the previous node.
Arrow Right
When focus is on a closed branch node, opens the branch. When focus is on an open branch node, moves focus to the first item node.
Arrow Left
When focus is on an open branch node, closes the node. When focus is on a item or branch node, moves focus to its parent branch node.
Home
Moves focus to first node without opening or closing a node.
End
Moves focus to the last node that can be focused without expanding any nodes that are closed.
a-z
Focus moves to the next node with a name that starts with the typed character, except for a, which the select-all shortcut takes. The search logic ignores nodes that are descendants of closed branch.
A-Z
Focus moves to the next node with a name that starts with the typed character. The search logic ignores nodes that are descendants of closed branch.
*
Expands all sibling nodes that are at the same depth as the focused node.
Shift+Arrow Down
Moves focus to and toggles the selection state of the next node.
Shift+Arrow Up
Moves focus to and toggles the selection state of the previous node.
Command+A
In a tree that allows multiple selection, selects every node and moves focus to the last one. Ctrl + A does nothing in the tree.
F2
When canRename allows the focused node, opens its name for editing. Enter saves the new name, and Escape cancels.

Demos

Checkbox tree

Every folder and file carries a TreeViewCheckbox, and the checked ids are held in state and printed beside the tree, with readme.md checked from the start. Checking a folder checks everything inside it, and a folder with only some files checked shows a dash. Use it to pick files for an export or a sync. From the keyboard, Space on a row checks or unchecks its box.

Preview width

Context menu

A right click on a folder offers Add folder, Add file, Rename and Delete, and on a file, Rename and Delete. ContextMenuTrigger wraps each row, so the menu belongs to the row that was clicked. Use it for actions that don't deserve a button on every row. The items here change nothing, so connect each one to your collection before shipping it.

Preview width

Controlled

A prompt asks for input.tsx, and the tree's selectedValue lives in state, set from onSelectionChange. The mark under the tree turns from a cross to a check once components/input.tsx is the selected id. Control the selection when something outside the tree reads it, such as a toolbar or a preview pane. The value is an array even with one node selected, so read its first id.

Preview width

Custom icons

fileIcons on TreeView, built with createFileIcons, maps an extension to an icon: code for .tsx, a JSON file for .json and text for .md. Folders keep their default icons. Use the map when the file type is in the suffix. The extension is read from each node's id, and one the map leaves out gets the default file icon.

Preview width

Custom icons folder

The app folder shows a package icon while closed and an open package while expanded, from icon and expandedIcon on its TreeViewBranchItem. The components folder sets both to null, so only its chevron and name show. Use a custom pair when a branch is a package or a drive rather than a folder, and null when a second icon adds nothing.

Preview width

Custom icons item

Every file passes a star as icon to TreeViewItem, while the folders keep their default icons. Use the item's icon for a marker the extension doesn't decide, such as a favorite or a pinned file. When fileIcons on TreeView also maps that file's extension, the map wins over the item's icon.

Preview width

Editor

Selecting a file opens it in a tab beside the tree, with a placeholder line for its contents and a button to close it, while selecting a folder only opens or closes it. Each new file replaces the tab. Use the split for an editor or a mail sidebar, where the tree picks what the main pane shows. The handler reads selectedNodes from onSelectionChange and skips folders.

Preview width

Lazy loading

The app and components folders arrive empty, each with a childrenCount of 2, and opening one calls loadChildren, which answers after a short delay as an API would. A spinner shows while the folder reports aria-busy, and onLoadChildrenComplete keeps the new collection in state. Use it when a tree is too large to send at once, such as a repository or a shared drive.

Preview width

The rows are anchors: Introduction and Components under Documentation stay on the site, GitHub Repository under External Links opens in a new tab with an external-link icon, and llms.txt is a link at the top level. TreeViewLabel names the tree Docs. Use links for a docs sidebar or a site map, and selection when choosing a row shouldn't navigate.

Preview width

Multiple selection

With selectionMode set to multiple, a click selects one row, a click with Ctrl or Cmd adds or removes one, and a click with Shift selects a range. Shift with the arrow keys extends the selection from the keyboard. Use it for a batch action, such as moving several files. A highlight is easy to lose while scrolling, so checkboxes say it more clearly when the set must stay obvious.

Preview width

Rename

canRename returns true for every node, and onRenameComplete writes the new name into the collection with replace. Focus a row and press F2 to edit its name in place, then Enter to save or Escape to cancel. Use it where people own the labels, such as folders they created. When a server owns the name, save it there before replacing the node.

Preview width

FAQ

How do I render a file tree from my data with the Tree View in React?

Build a collection with createTreeCollection from a root node whose children are your folders and files, each with a unique id and a name, and pass it to TreeView as collection. Render the root's children with a component that draws a branch for a node with children and an item for one without, calling itself for each child, as the TreeNode in Usage does.

The tree counts a node as a branch only when it has at least one child. Give an empty folder a childrenCount of 0 to keep it a branch.

How do I control which Tree View item is selected?

Keep the selected ids in state, pass them as selectedValue and update them from onSelectionChange, which receives an object with the new selectedValue. The value is always an array, even with one node selected, as the Controlled demo shows.

For a starting selection without your own state, use defaultSelectedValue. Set selectionMode to multiple to let several nodes stay selected, as in the Multiple selection demo.

How do I expand Tree View folders by default?

List the ids of the folders to open in defaultExpandedValue on TreeView, such as ["app"]. To open or close them from your own code, hold the ids in state and pass them as expandedValue, updated from onExpandedChange, and set it to collection.getBranchValues() for an Expand all button.

A click on a folder selects it and toggles it. With expandOnClick set to false, a click or Enter only selects it, and since these rows have no separate toggle, only the keyboard can then open the folder: the Right arrow key, or * for it and its siblings.

How do I add checkboxes to the Tree View?

Put a TreeViewCheckbox in each row and hold the checked ids in checkedValue, updated from onCheckedChange, as the Checkbox tree demo does. Checking a folder checks every node inside it, and the folder's box shows a dash while only some are checked.

The checkboxes stay out of the tab order, so the tree is still a single Tab stop. Space on the focused row checks or unchecks its box, and Enter selects the row.

How do I load Tree View children lazily from an API?

Pass loadChildren, an async function that receives the folder being opened as node, with an abort signal, and returns its children. Give each unloaded folder a childrenCount so the tree treats it as a branch, and in your node component test for a folder with collection.isBranchNode(node) rather than node.children, which stays undefined until the load. The Lazy loading demo does both.

When the children arrive, onLoadChildrenComplete hands you the new collection to keep in state. A failed load calls onLoadChildrenError, and a folder reports aria-busy while it loads.

How do I change the file and folder icons in a Tree View?

Pass fileIcons to TreeView, built with createFileIcons, to pick a file's icon by its extension, as the Custom icons demo does, reading the extension from the node's id. For one file, set icon on its TreeViewItem, though a match in fileIcons wins over it. Map an extension to null to show no icon for it.

A folder takes icon for its closed state and expandedIcon for its open state on TreeViewBranchItem, and null hides either one. A row with a checkbox hides its file icon to make room.

How do I add, rename or delete nodes in a Tree View?

Keep the collection in state and replace it with a new one. A collection never changes in place: replace, remove, insertBefore, insertAfter and move each return a new collection, and they take index paths, which collection.getIndexPath finds from an id.

The Rename demo does this for renaming, with canRename to allow F2 and onRenameComplete calling replace. For a search box above the tree, filter returns a copy that keeps the matching nodes and the folders above them.

Is the Tree View accessible with the keyboard?

Mostly. The tree is one Tab stop, Up and Down move between visible rows, Right opens a folder or steps into it, Left closes it or steps out to its parent, and typing a letter jumps to the next row whose name starts with it. Enter and Space select the focused row, and on a folder they open or close it too.

On a row with a checkbox, Space checks or unchecks it instead. One gap remains: the letter a never jumps, because the select-all shortcut takes it. The Accessibility section lists every key.

API Reference

TreeView

<div> data-slot="tree-view"

PropType
collectionTreeCollection<T>

The collection of tree nodes.

Type
TreeCollection<T>
canRename?(node: T, indexPath: IndexPath) → boolean

Function to determine if a node can be renamed.

Type
(node: T, indexPath: IndexPath) → boolean
Parameters

node – T

indexPath – IndexPath

Returns
boolean
checkedValue?string[]

The controlled checked node value.

defaultCheckedValue?string[]

The initial checked node value when rendered. Use when you don't need to control the checked node value.

defaultExpandedValue?string[]

The initial expanded node ids when rendered. Use when you don't need to control the expanded node value.

defaultFocusedValue?string | null

The initial focused node value when rendered. Use when you don't need to control the focused node value.

Type
string | null
defaultSelectedValue?string[]

The initial selected node value when rendered. Use when you don't need to control the selected node value.

dir?"ltr" | "rtl"

The document's text/writing direction.

Type
"ltr" | "rtl"
Default
"ltr"
expandedValue?string[]

The controlled expanded node ids.

expandOnClick?boolean

Whether clicking on a branch should open it or not.

Default
true
focusedValue?string | null

The value of the focused node.

Type
string | null
hideMode?"display-none" | "activity"

How to hide content when mounted but not present. - display-none: HTML hidden attribute. Effects stay alive. - activity: React 19 <Activity mode="hidden">. Effects pause. Requires React 19+.

Type
"display-none" | "activity"
Default
"display-none"
id?string

The unique identifier of the machine.

ids?object

The ids of the tree elements. Useful for composition.

Type
{ root?: string; tree?: string; label?: string; node?: (value: string) → string }
lazyMount?boolean

Whether to enable lazy mounting. Ark default: false.

Default
true
loadChildren?(details: LoadChildrenDetails<T>) → Promise<T[]>

Function to load children for a node asynchronously. When provided, branches will wait for this promise to resolve before expanding.

Type
(details: LoadChildrenDetails<T>) → Promise<T[]>
Parameters

details – LoadChildrenDetails<T>

Returns
Promise<T[]>
onBeforeRename?(details: RenameCompleteDetails) → boolean

Called before a rename is completed. Return false to prevent the rename.

Type
(details: RenameCompleteDetails) → boolean
Parameters

details – { value: string; label: string; indexPath: IndexPath }

Returns
boolean
onCheckedChange?(details: CheckedChangeDetails) → void

Called when the checked value changes.

Type
(details: CheckedChangeDetails) → void
Parameters

details – { checkedValue: string[] }

Returns
void
onExpandedChange?(details: ExpandedChangeDetails<T>) → void

Called when the tree is opened or closed.

Type
(details: ExpandedChangeDetails<T>) → void
Parameters

details – ExpandedChangeDetails<T>

Returns
void
onFocusChange?(details: FocusChangeDetails<T>) → void

Called when the focused node changes.

Type
(details: FocusChangeDetails<T>) → void
Parameters

details – FocusChangeDetails<T>

Returns
void
onLoadChildrenComplete?(details: LoadChildrenCompleteDetails<T>) → void

Called when a node finishes loading children.

Type
(details: LoadChildrenCompleteDetails<T>) → void
Parameters

details – LoadChildrenCompleteDetails<T>

Returns
void
onLoadChildrenError?(details: LoadChildrenErrorDetails<T>) → void

Called when loading children fails for one or more nodes.

Type
(details: LoadChildrenErrorDetails<T>) → void
Parameters

details – LoadChildrenErrorDetails<T>

Returns
void
onRenameComplete?(details: RenameCompleteDetails) → void

Called when a node label rename is completed.

Type
(details: RenameCompleteDetails) → void
Parameters

details – { value: string; label: string; indexPath: IndexPath }

Returns
void
onRenameStart?(details: RenameStartDetails<T>) → void

Called when a node starts being renamed.

Type
(details: RenameStartDetails<T>) → void
Parameters

details – RenameStartDetails<T>

Returns
void
onSelectionChange?(details: SelectionChangeDetails<T>) → void

Called when the selection changes.

Type
(details: SelectionChangeDetails<T>) → void
Parameters

details – SelectionChangeDetails<T>

Returns
void
scrollToIndexFn?(details: ScrollToIndexDetails<T>) → void

Function to scroll to a specific index. Useful for virtualized tree views.

Type
(details: ScrollToIndexDetails<T>) → void
Parameters

details – ScrollToIndexDetails<T>

Returns
void
selectedValue?string[]

The controlled selected node value.

selectionMode?"single" | "multiple"

Whether the tree supports multiple selection - "single": only one node can be selected - "multiple": multiple nodes can be selected

Type
"single" | "multiple"
Default
"single"
translations?object

Specifies the localized strings that identifies the accessibility elements and their states.

Type
{ treeLabel?: string; renameInputLabel?: string }
typeahead?boolean

Whether the tree supports typeahead search.

Default
true
unmountOnExit?boolean

Whether to unmount on exit. Ark default: false.

Default
true
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-motion?string

Present after onExpandedChange.

TreeViewBranch

<div> data-slot="tree-view-branch"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-branchstring

Mirrors value.

data-depthstring

Mirrors depth.

data-disabled?string

Present when disabled is true.

data-loading?string

Present when loading is true.

data-ownedbystring

Id of the tree part.

data-pathstring
data-selected?string

Present when selected is true.

data-state"open" | "closed"

"open" or "closed".

Type
"open" | "closed"
data-valuestring

The item's value.

CSS variableType
--depthstring
--icon-sizestring
--indentationstring
--item-gapstring
--padding-blockstring
--padding-inlinestring

TreeViewBranchContent

<div> data-slot="tree-view-branch-content"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-depthstring

Mirrors depth.

data-pathstring
data-state"open" | "closed"

"open" or "closed".

Type
"open" | "closed"
data-valuestring

The item's value.

CSS variableType
--depthstring
--icon-sizestring
--indentationstring
--padding-inlinestring

TreeViewBranchItem

<div> data-slot="tree-view-branch-control"

PropType
expandedIcon?React.JSX.ElementType | null

Custom expanded icon.

Type
React.JSX.ElementType | null
Default
<FolderOpenIcon />
icon?React.JSX.ElementType | null

Custom icon.

Type
React.JSX.ElementType | null
Default
<FolderIcon />
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-checked?string

Present when checked.

data-depthstring

Mirrors depth.

data-disabled?string

Present when disabled is true.

data-focus?string

Present when focused is true.

data-indeterminate?string

Present when indeterminate.

data-loading?string

Present when loading is true.

data-pathstring
data-renaming?string

Present when renaming is true.

data-selected?string

Present when selected is true.

data-state"open" | "closed"

"open" or "closed".

Type
"open" | "closed"
data-valuestring

The item's value.

TreeViewBranchIndentGuide

<div> data-slot="tree-view-branch-indent-guide"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

AttributeType
data-depthstring

Mirrors depth.

CSS variableType
--depthstring
--icon-sizestring
--indentationstring
--padding-inlinestring

TreeViewBranchIndicator

<div> data-slot="tree-view-branch-indicator"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-disabled?string

Present when disabled is true.

data-focus?string

Present when focused is true.

data-loading?string

Present when loading is true.

data-selected?string

Present when selected is true.

data-state"open" | "closed"

"open" or "closed".

Type
"open" | "closed"

TreeViewContent

<div> data-slot="tree-view-item"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-checked?string

Present when checked.

data-depthstring

Mirrors depth.

data-disabled?string

Present when disabled is true.

data-focus?string

Present when focused is true.

data-indeterminate?string

Present when indeterminate.

data-ownedbystring

Id of the tree part.

data-pathstring
data-renaming?string

Present when renaming is true.

data-selected?string

Present when selected is true.

data-valuestring

The item's value.

CSS variableType
--depthstring

TreeViewItem

<span> data-slot="tree-view-item-title"

PropType
icon?React.JSX.ElementType

Custom file icon.

Default
<FileIcon />
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-disabled?string

Present when disabled is true.

data-focus?string

Present when focused is true.

data-selected?string

Present when selected is true.

CSS variableType
--item-gapstring

TreeViewLabel

<h3> data-slot="tree-view-label"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

TreeViewCheckbox

<span> data-slot="tree-view-checkbox"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-disabled?string

Present when disabled.

data-state"checked" | "unchecked" | "indeterminate"

"checked", "unchecked" or "indeterminate".

Type
"checked" | "unchecked" | "indeterminate"

TreeViewNodeRenameInput

<input> data-slot="tree-view-node-rename-input"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

TreeViewTree

<div> data-slot="tree-view-tree"

PropType
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-branch?string
CSS variableType
--icon-sizestring

TreeViewNode

data-slot="tree-view-node"

PropType
indexPathnumber[]

The index path of the tree node.

nodeT

The tree node.

useTreeView

PropType
collectionTreeCollection<T>

The collection of tree nodes.

Type
TreeCollection<T>
canRename?(node: T, indexPath: IndexPath) → boolean

Function to determine if a node can be renamed.

Type
(node: T, indexPath: IndexPath) → boolean
Parameters

node – T

indexPath – IndexPath

Returns
boolean
checkedValue?string[]

The controlled checked node value.

defaultCheckedValue?string[]

The initial checked node value when rendered. Use when you don't need to control the checked node value.

defaultExpandedValue?string[]

The initial expanded node ids when rendered. Use when you don't need to control the expanded node value.

defaultFocusedValue?string | null

The initial focused node value when rendered. Use when you don't need to control the focused node value.

Type
string | null
defaultSelectedValue?string[]

The initial selected node value when rendered. Use when you don't need to control the selected node value.

expandedValue?string[]

The controlled expanded node ids.

expandOnClick?boolean

Whether clicking on a branch should open it or not.

Default
true
focusedValue?string | null

The value of the focused node.

Type
string | null
id?string

The unique identifier of the machine.

ids?object

The ids of the tree elements. Useful for composition.

Type
{ root?: string; tree?: string; label?: string; node?: (value: string) → string }
loadChildren?(details: LoadChildrenDetails<T>) → Promise<T[]>

Function to load children for a node asynchronously. When provided, branches will wait for this promise to resolve before expanding.

Type
(details: LoadChildrenDetails<T>) → Promise<T[]>
Parameters

details – LoadChildrenDetails<T>

Returns
Promise<T[]>
onBeforeRename?(details: RenameCompleteDetails) → boolean

Called before a rename is completed. Return false to prevent the rename.

Type
(details: RenameCompleteDetails) → boolean
Parameters

details – { value: string; label: string; indexPath: IndexPath }

Returns
boolean
onCheckedChange?(details: CheckedChangeDetails) → void

Called when the checked value changes.

Type
(details: CheckedChangeDetails) → void
Parameters

details – { checkedValue: string[] }

Returns
void
onExpandedChange?(details: ExpandedChangeDetails<T>) → void

Called when the tree is opened or closed.

Type
(details: ExpandedChangeDetails<T>) → void
Parameters

details – ExpandedChangeDetails<T>

Returns
void
onFocusChange?(details: FocusChangeDetails<T>) → void

Called when the focused node changes.

Type
(details: FocusChangeDetails<T>) → void
Parameters

details – FocusChangeDetails<T>

Returns
void
onLoadChildrenComplete?(details: LoadChildrenCompleteDetails<T>) → void

Called when a node finishes loading children.

Type
(details: LoadChildrenCompleteDetails<T>) → void
Parameters

details – LoadChildrenCompleteDetails<T>

Returns
void
onLoadChildrenError?(details: LoadChildrenErrorDetails<T>) → void

Called when loading children fails for one or more nodes.

Type
(details: LoadChildrenErrorDetails<T>) → void
Parameters

details – LoadChildrenErrorDetails<T>

Returns
void
onRenameComplete?(details: RenameCompleteDetails) → void

Called when a node label rename is completed.

Type
(details: RenameCompleteDetails) → void
Parameters

details – { value: string; label: string; indexPath: IndexPath }

Returns
void
onRenameStart?(details: RenameStartDetails<T>) → void

Called when a node starts being renamed.

Type
(details: RenameStartDetails<T>) → void
Parameters

details – RenameStartDetails<T>

Returns
void
onSelectionChange?(details: SelectionChangeDetails<T>) → void

Called when the selection changes.

Type
(details: SelectionChangeDetails<T>) → void
Parameters

details – SelectionChangeDetails<T>

Returns
void
scrollToIndexFn?(details: ScrollToIndexDetails<T>) → void

Function to scroll to a specific index. Useful for virtualized tree views.

Type
(details: ScrollToIndexDetails<T>) → void
Parameters

details – ScrollToIndexDetails<T>

Returns
void
selectedValue?string[]

The controlled selected node value.

selectionMode?"single" | "multiple"

Whether the tree supports multiple selection - "single": only one node can be selected - "multiple": multiple nodes can be selected

Type
"single" | "multiple"
Default
"single"
translations?object

Specifies the localized strings that identifies the accessibility elements and their states.

Type
{ treeLabel?: string; renameInputLabel?: string }
typeahead?boolean

Whether the tree supports typeahead search.

Default
true