string[]The initial expanded node ids when rendered.
Use when you don't need to control the expanded node ids.
defaultSelectedValue
string[]The initial selected node ids when rendered.
Use when you don't need to control the selected node ids.
expandedValue
string[]The controlled expanded node ids
expandOnClick
true
booleanWhether clicking on a branch should open it or not
focusedValue
stringThe id of the focused node
id
stringThe unique identifier of the machine.
ids
{
root?: string;
tree?: string;
label?: string;
node(value: string)?: string;
}The ids of the tree elements. Useful for composition.
keepMounted
booleanWhether to keep the component mounted after exit.
lazyMount
booleanWhether to enable lazy mounting.
onExpandedChange
(details: ExpandedChangeDetails) => voidCalled when the tree is opened or closed
onFocusChange
(details: FocusChangeDetails) => voidCalled when the focused node changes
onSelectionChange
(details: SelectionChangeDetails) => voidCalled when the selection changes
selectedValue
string[]The controlled selected node ids
selectionMode
"single"
"single" | "multiple"Whether the tree supports multiple selection
- "single": only one node can be selected
- "multiple": multiple nodes can be selected
typeahead
true
booleanWhether the tree supports typeahead search
asChild
SnippetRender a different element.
Branch
Prop
Default
Description
indexPath
number[]
node
any
asChild
SnippetRender a different element.
Data Attribute
Value
data-branch
data-depth
The depth of the item
data-disabled
Present when disabled
data-part
branch
data-path
The path of the item
data-scope
tree-view
data-selected
Present when selected
data-state
"open" | "closed"
data-value
The value of the item
BranchContent
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-depth
The depth of the item
data-part
branch-content
data-path
The path of the item
data-scope
tree-view
data-state
"open" | "closed"
data-value
The value of the item
BranchControl
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-depth
The depth of the item
data-disabled
Present when disabled
data-focus
Present when focused
data-part
branch-control
data-path
The path of the item
data-scope
tree-view
data-selected
Present when selected
data-state
"open" | "closed"
data-value
The value of the item
BranchIndentGuide
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-depth
The depth of the item
data-part
branch-indent-guide
data-scope
tree-view
BranchIndicator
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-focus
Present when focused
data-part
branch-indicator
data-scope
tree-view
data-selected
Present when selected
data-state
"open" | "closed"
BranchText
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-part
branch-text
data-scope
tree-view
data-state
"open" | "closed"
BranchTrigger
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-part
branch-trigger
data-scope
tree-view
data-state
"open" | "closed"
data-value
The value of the item
Item
Prop
Default
Description
indexPath
number[]
node
any
asChild
SnippetRender a different element.
Data Attribute
Value
data-depth
The depth of the item
data-disabled
Present when disabled
data-focus
Present when focused
data-part
item
data-path
The path of the item
data-scope
tree-view
data-selected
Present when selected
data-value
The value of the item
ItemIndicator
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-focus
Present when focused
data-part
item-indicator
data-scope
tree-view
data-selected
Present when selected
ItemText
Prop
Default
Description
asChild
SnippetRender a different element.
Data Attribute
Value
data-disabled
Present when disabled
data-focus
Present when focused
data-part
item-text
data-scope
tree-view
data-selected
Present when selected
Label
Prop
Default
Description
asChild
SnippetRender a different element.
Tree
Prop
Default
Description
asChild
SnippetRender a different element.
Accessibility
Keyboard Support
Key
Description
Tab
Moves focus to the tree view, placing the first tree view item in focus.
Enter + Space
Selects the item or branch node
ArrowDown
Moves focus to the next node
ArrowUp
Moves focus to the previous node
ArrowRight
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.
ArrowLeft
When focus is on an open branch node, closes the node. When focus is on an 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 + 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 + ArrowDown
Moves focus to and toggles the selection state of the next node.
Shift + ArrowUp
Moves focus to and toggles the selection state of the previous node.
Ctrl + A
Selects all nodes in the tree. If all nodes are selected, unselects all nodes.