Tree API

API documentation for Tree component

Tree#

Props#

Defines valid properties in Tree component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeInstance) => ReactNode)
null
The children to render.
onExpandedChange(event: TreeExpandedChangeEvent) => void
null
Callback fired when the tree's expanded keys state changes.
onSelectionChange(event: TreeSelectionChangeEvent) => void
null
Callback fired when the tree's selection keys state changes.
onValueChange(event: TreeValueChangeEvent) => void
null
Callback fired when the tree's value state changes.
valueTreeNode[]
null
An array of treenodes.
expandedKeysTreeExpandedKeys
null
A record of keys to represent the state of the tree expansion state in controlled mode.
defaultExpandedKeysTreeExpandedKeys
null
The default expanded keys when used in uncontrolled mode.
selectionKeysTreeSelectionKeys | TreeCheckboxSelectionKeys
null
A record of keys to represent the selection state in controlled mode. For single/multiple mode: Record<string, boolean> For checkbox mode: Record<string, { checked: boolean, partialChecked: boolean }>
defaultSelectionKeysTreeSelectionKeys | TreeCheckboxSelectionKeys
null
The default selected keys when used in uncontrolled mode.
selectionMode"checkbox" | "multiple" | "single"
null
Defines the selection mode.
metaKeySelectionboolean
false
Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect multiple items. When set to false selection of each item can be toggled individually.
scrollHeight"flex"
null
Height of the scroll viewport in fixed units or the 'flex' keyword for a dynamic size.
highlightOnSelectboolean
false
Highlights automatically the first item.
draggableNodesboolean
null
Whether the tree nodes can be dragged.
droppableNodesboolean
null
Whether the tree can accept dropped nodes.
draggableScopestring | string[]
null
A unique identifier for the draggable scope.
droppableScopestring | string[]
null
A unique identifier for the droppable scope.
validateDropboolean
false
Whether to validate drops before processing.
onToggle(event: useTreeToggleEvent) => void
null
Callback fired when a node is toggled.
onExpand(event: useTreeExpandEvent) => void
null
Callback fired when a node is toggled.
onCollapse(event: useTreeCollapseEvent) => void
null
Callback fired when a node is toggled.
onClick(event: useTreeClickEvent) => void
null
Callback fired when a node is clicked.
onSelect(event: useTreeSelectEvent) => void
null
Callback fired when a node is selected.
onUnselect(event: useTreeUnselectEvent) => void
null
Callback fired when a node is unselected.
onNodeDrop(event: useTreeNodeDropEvent) => void
null
Callback fired when a node is dropped.
onDragEnter(event: useTreeDragEnterEvent) => void
null
Callback fired when drag enters the tree.
onDragLeave(event: useTreeDragLeaveEvent) => void
null
Callback fired when drag leaves the tree.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Tree component.

nametypedefaultdescription
expandedKeyTreeExpandedKeys
null
The current expanded keys of the tree.
selectedKeyTreeSelectionKeys | TreeCheckboxSelectionKeys
null
The current selected keys of the tree.
dragHoverboolean
null
Whether the tree is in drag hover state.

Exposes#

Defines the methods and properties exposed by Tree component.

nametypedefaultdescription
stateuseTreeState
null
The state of the useTree.
getNodes() => TreeNode[]
null
Gets the list of tree nodes.
onKeyDown(event: KeyboardEvent, node: TreeNode, level: number, expanded: boolean, leaf: boolean) => void
null
Handles keyboard navigation on tree nodes.
onNodeToggle(event: SyntheticEvent, node: TreeNode) => void
null
Toggles the expansion state of a node.
onNodeClick(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>, node: TreeNode, nodeTouched?: boolean) => void
null
Handles node click event.
onClick(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>, node: TreeNode, nodeTouched?: boolean) => void
null
Handles content click event. Automatically delegates to checkbox or node click based on selection mode.
onCheckboxChange(event: ChangeEvent<HTMLInputElement>, node: TreeNode) => void
null
Handles checkbox state change for checkbox selection mode.
isNodeSelected(node: TreeNode) => boolean
null
Checks if a node is selected.
findNodeInfo(nodeKey: string) => { level: number; posInSet: number; setSize: number }
null
Finds information about a node's position in the tree.
allowDrop(node: TreeNode) => boolean
null
Checks if a node can be dropped based on drag-drop rules.

Events#

Event fired when the tree's expanded keys state changes.

nametypedescription
valueTreeExpandedKeysThe new expanded keys.
originalEventSyntheticEventThe original event that triggered the expansion change.

Event fired when the tree's selection keys state changes.

nametypedescription
valueTreeSelectionKeys | TreeCheckboxSelectionKeysThe new selection keys.
originalEventSyntheticEventThe original event that triggered the selection change.

Event fired when the tree's value state changes.

nametypedescription
valueTreeNode[]The new value.

Interfaces#

Defines passthrough(pt) options of Tree component.

nametypedefaultdescription
rootTreePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
wrapperTreePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the wrapper's DOM element.
listTreePassThroughType<HTMLAttributes<HTMLUListElement>>
null
Used to pass attributes to the list's DOM element.
nodeTreePassThroughType<HTMLAttributes<HTMLLIElement>>
null
Used to pass attributes to the node's DOM element.
contentTreePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the content's DOM element.
labelTreePassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the label's DOM element.
toggleTreePassThroughType<ButtonHTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the toggle button's DOM element.
toggleIconTreePassThroughType<SVGProps<SVGSVGElement>>
null
Used to pass attributes to the toggle icon's DOM element.
pcCheckboxTreePassThroughType<HTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the checkbox's DOM element.
pcFilterTreePassThroughType<HTMLAttributes<HTMLElement>>
null
Used to pass attributes to the filter's DOM element.
headerTreePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the header's DOM element.
footerTreePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the footer's DOM element.
emptyTreePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the empty message's DOM element.
dropPointTreePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the drop point's DOM element.

Types#

Instance of Tree component.

values
ComponentInstance<TreeProps, TreeState, TreeExposes>

TreeList#

Props#

Defines valid properties in TreeList component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeListInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeListInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeListPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeListInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeList component.

nametypedefaultdescription
treeTreeInstance
null
The Tree component instance.
treenodeTreeNodeInstance
null
The TreeNode component instance.
nodesunknown[]
null
Array of nodes.

Interfaces#

Defines passthrough(pt) options of TreeList component.

nametypedefaultdescription
rootTreeListPassThroughType<HTMLAttributes<HTMLUListElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeList component.

values
ComponentInstance<TreeListProps, TreeListState, TreeListExposes>

TreeNode#

Props#

Defines valid properties in TreeNode component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeNodeInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeNodeInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeNodePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeNodeInstance) => ReactNode)
null
The children to render.
nodeTreeNode
null
Node data. See TreeNode interface for more information.
indexnumber
null
Index of the node in the list of siblings.
draggableNodesboolean
null
Whether nodes can be dragged.
droppableNodesboolean
null
Whether nodes can accept drops.
draggableScopestring | string[]
null
Draggable scope identifier.
droppableScopestring | string[]
null
Droppable scope identifier.
validateDropboolean
false
Whether to validate drops before processing.
onNodeDrop(event: TreeNodeDropEvent) => void
null
Callback fired when a node is dropped on this node.
onNodeDragEnter(event: TreeNodeDragEnterEvent) => void
null
Callback fired when drag enters this node.
onNodeDragLeave(event: TreeNodeDragLeaveEvent) => void
null
Callback fired when drag leaves this node.
onValueChange(event: TreeNodeValueChangeEvent) => void
null
Callback fired when the tree value changes.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeNode component.

nametypedefaultdescription
treeTreeInstance
null
The Tree component instance.
parentNodeTreeNodeInstance
null
The parent TreeNode component instance.
expandedboolean
null
Whether the node is expanded.
checkedboolean
null
Whether the node is checked (for checkbox mode).
partialCheckedboolean
null
Whether the node is partially checked (for checkbox mode).
selectedboolean
null
Whether the node is selected (for single/multiple mode).
leafboolean
null
Whether the node is a leaf node (has no children).
setSizenumber
null
The total number of siblings at this level.
posInSetnumber
null
The position of this node among its siblings (1-based).
levelnumber
null
The depth level of the node in the tree (1-based).

Events#

Event fired when a node is dropped on this node.

nametypedescription
originalEventDragEventThe original drag event.
valueTreeNode[]The value of the tree.
dragNodeTreeNodeThe dragged node.
dropNodeTreeNodeThe drop target node.
indexnumberThe index of the dropped node.
accept() => voidAccept callback for validateDrop mode.

Event fired when drag enters a node.

nametypedescription
nodeTreeNodeThe node being entered.

Event fired when drag leaves a node.

nametypedescription
nodeTreeNodeThe node being left.

Event fired when the tree value changes due to drag-drop.

nametypedescription
nodesTreeNode[]The updated tree nodes.

Interfaces#

Defines passthrough(pt) options of TreeNode component.

nametypedefaultdescription
rootTreeNodePassThroughType<HTMLAttributes<HTMLLIElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeNode component.

values
ComponentInstance<TreeNodeProps, TreeNodeState, TreeNodeExposes>

TreeContent#

Props#

Defines valid properties in TreeContent component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeContentInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeContentInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeContentPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeContentInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeContent component.

nametypedefaultdescription
treeTreeInstance
null
The Tree component instance.
treenodeTreeNodeInstance
null
The TreeNode component instance.

Interfaces#

Defines passthrough(pt) options of TreeContent component.

nametypedefaultdescription
rootTreeContentPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeContent component.

values
ComponentInstance<TreeContentProps, TreeContentState, TreeContentExposes>

TreeToggle#

Props#

Defines valid properties in TreeToggle component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeToggleInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeToggleInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeTogglePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeToggleInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeToggle component.

nametypedefaultdescription
treeTreeInstance
null
The Tree component instance.
treenodeTreeNodeInstance
null
The TreeNode component instance.

Interfaces#

Defines passthrough(pt) options of TreeToggle component.

nametypedefaultdescription
rootTreeTogglePassThroughType<ButtonHTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.
toggleIconTreeTogglePassThroughType<SVGProps<SVGSVGElement>>
null
Used to pass attributes to the toggle icon's DOM element.

Types#

Instance of TreeToggle component.

values
ComponentInstance<TreeToggleProps, TreeToggleState, TreeToggleExposes>

TreeLabel#

Props#

Defines valid properties in TreeLabel component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeLabelInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeLabelInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeLabelPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeLabelInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeLabel component.

nametypedefaultdescription
treeTreeInstance
null
The Tree component instance.
treenodeTreeNodeInstance
null
The TreeNode component instance.

Interfaces#

Defines passthrough(pt) options of TreeLabel component.

nametypedefaultdescription
rootTreeLabelPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeLabel component.

values
ComponentInstance<TreeLabelProps, TreeLabelState, TreeLabelExposes>

TreeIcon#

Props#

Defines valid properties in TreeIcon component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeIconInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeIconInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeIconPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeIconInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeIcon component.

nametypedefaultdescription
treeTreeInstance
null
The Tree component instance.

Interfaces#

Defines passthrough(pt) options of TreeIcon component.

nametypedefaultdescription
rootTreeIconPassThroughType<SVGAttributes<SVGElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeIcon component.

values
ComponentInstance<TreeIconProps, TreeIconState, TreeIconExposes>

TreeHeader#

Props#

Defines valid properties in TreeHeader component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeHeaderInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeHeaderInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeHeaderPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeHeaderInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeHeader component.

nametypedefaultdescription
treeTreeInstance
null
The TreeHeader component instance.

Interfaces#

Defines passthrough(pt) options of TreeHeader component.

nametypedefaultdescription
rootTreeHeaderPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeHeader component.

values
ComponentInstance<TreeHeaderProps, TreeHeaderState, TreeHeaderExposes>

TreeFilter#

Props#

Defines valid properties in TreeFilter component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeFilterInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeFilterInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeFilterPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeFilterInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeFilter component.

nametypedefaultdescription
treeTreeInstance
null
The TreeFilter component instance.

Interfaces#

Defines passthrough(pt) options of TreeFilter component.

nametypedefaultdescription
rootTreeFilterPassThroughType<HTMLAttributes<HTMLElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeFilter component.

values
ComponentInstance<TreeFilterProps, TreeFilterState, TreeFilterExposes>

TreeFooter#

Props#

Defines valid properties in TreeFooter component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeFooterInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeFooterInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeFooterPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeFooterInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeFooter component.

nametypedefaultdescription
treeTreeInstance
null
The TreeFooter component instance.

Interfaces#

Defines passthrough(pt) options of TreeFooter component.

nametypedefaultdescription
rootTreeFooterPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeFooter component.

values
ComponentInstance<TreeFooterProps, TreeFooterState, TreeFooterExposes>

TreeEmpty#

Props#

Defines valid properties in TreeEmpty component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: TreeEmptyInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: TreeEmptyInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<TreeEmptyPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: TreeEmptyInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by TreeEmpty component.

nametypedefaultdescription
treeTreeInstance
null
The TreeEmpty component instance.

Interfaces#

Defines passthrough(pt) options of TreeEmpty component.

nametypedefaultdescription
rootTreeEmptyPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of TreeEmpty component.

values
ComponentInstance<TreeEmptyProps, TreeEmptyState, TreeEmptyExposes>

useTree#

Props#

Defines valid properties in useTree.

nametypedefaultdescription
valueTreeNode[]
null
An array of treenodes.
expandedKeysTreeExpandedKeys
null
A record of keys to represent the state of the tree expansion state in controlled mode.
defaultExpandedKeysTreeExpandedKeys
null
The default expanded keys when used in uncontrolled mode.
selectionKeysTreeSelectionKeys | TreeCheckboxSelectionKeys
null
A record of keys to represent the selection state in controlled mode. For single/multiple mode: Record<string, boolean> For checkbox mode: Record<string, { checked: boolean, partialChecked: boolean }>
defaultSelectionKeysTreeSelectionKeys | TreeCheckboxSelectionKeys
null
The default selected keys when used in uncontrolled mode.
selectionMode"checkbox" | "multiple" | "single"
null
Defines the selection mode.
metaKeySelectionboolean
false
Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect multiple items. When set to false selection of each item can be toggled individually.
scrollHeight"flex"
null
Height of the scroll viewport in fixed units or the 'flex' keyword for a dynamic size.
highlightOnSelectboolean
false
Highlights automatically the first item.
draggableNodesboolean
null
Whether the tree nodes can be dragged.
droppableNodesboolean
null
Whether the tree can accept dropped nodes.
draggableScopestring | string[]
null
A unique identifier for the draggable scope.
droppableScopestring | string[]
null
A unique identifier for the droppable scope.
validateDropboolean
false
Whether to validate drops before processing.
onExpandedChange(event: useTreeExpandedChangeEvent) => void
null
Callback fired when the tree's expanded keys change.
onSelectionChange(event: useTreeSelectionChangeEvent) => void
null
Callback fired when the tree's selection changes.
onToggle(event: useTreeToggleEvent) => void
null
Callback fired when a node is toggled.
onExpand(event: useTreeExpandEvent) => void
null
Callback fired when a node is toggled.
onCollapse(event: useTreeCollapseEvent) => void
null
Callback fired when a node is toggled.
onClick(event: useTreeClickEvent) => void
null
Callback fired when a node is clicked.
onSelect(event: useTreeSelectEvent) => void
null
Callback fired when a node is selected.
onUnselect(event: useTreeUnselectEvent) => void
null
Callback fired when a node is unselected.
onNodeDrop(event: useTreeNodeDropEvent) => void
null
Callback fired when a node is dropped.
onDragEnter(event: useTreeDragEnterEvent) => void
null
Callback fired when drag enters the tree.
onDragLeave(event: useTreeDragLeaveEvent) => void
null
Callback fired when drag leaves the tree.
onValueChange(event: useTreeValueChangeEvent) => void
null
Callback fired when the tree value changes (for drag-drop).

State#

Defines valid state in useTree.

nametypedefaultdescription
expandedKeyTreeExpandedKeys
null
The current expanded keys of the tree.
selectedKeyTreeSelectionKeys | TreeCheckboxSelectionKeys
null
The current selected keys of the tree.
dragHoverboolean
null
Whether the tree is in drag hover state.

Exposes#

Defines the methods and properties exposed by useTree.

nametypedefaultdescription
stateuseTreeState
null
The state of the useTree.
getNodes() => TreeNode[]
null
Gets the list of tree nodes.
onKeyDown(event: KeyboardEvent, node: TreeNode, level: number, expanded: boolean, leaf: boolean) => void
null
Handles keyboard navigation on tree nodes.
onNodeToggle(event: SyntheticEvent, node: TreeNode) => void
null
Toggles the expansion state of a node.
onNodeClick(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>, node: TreeNode, nodeTouched?: boolean) => void
null
Handles node click event.
onClick(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>, node: TreeNode, nodeTouched?: boolean) => void
null
Handles content click event. Automatically delegates to checkbox or node click based on selection mode.
onCheckboxChange(event: ChangeEvent<HTMLInputElement>, node: TreeNode) => void
null
Handles checkbox state change for checkbox selection mode.
isNodeSelected(node: TreeNode) => boolean
null
Checks if a node is selected.
findNodeInfo(nodeKey: string) => { level: number; posInSet: number; setSize: number }
null
Finds information about a node's position in the tree.
allowDrop(node: TreeNode) => boolean
null
Checks if a node can be dropped based on drag-drop rules.

Events#

Event fired when the tree's expanded keys change.

nametypedescription
originalEventEThe original event that triggered the expansion change.
valueTreeExpandedKeysThe new expanded keys.

Event fired when the tree's selected keys change.

nametypedescription
originalEventEThe original event that triggered the selection change.
valueTreeSelectionKeys | TreeCheckboxSelectionKeysThe new selected keys.

Event fired when a node is toggled.

nametypedescription
originalEventSyntheticEventThe original event that triggered the toggle.
nodeTreeNodeThe toggled node.

Event fired when a node is expanded.

nametypedescription
originalEventSyntheticEventThe original event that triggered the toggle.
nodeTreeNodeThe expanded node.

Event fired when a node is collapsed.

nametypedescription
originalEventSyntheticEventThe original event that triggered the collapse.
nodeTreeNodeThe collapsed node.

Event fired when a node is clicked.

nametypedescription
originalEventMouseEvent<Element, MouseEvent> | KeyboardEvent<Element>The original event that triggered the click.
nodeTreeNodeThe clicked node.

Event fired when a node is selected.

nametypedescription
originalEventSyntheticEvent<Element, Event> | MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>The original event that triggered the selection.
nodeTreeNodeThe selected node.

Event fired when a node is unselected.

nametypedescription
originalEventSyntheticEvent<Element, Event> | MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>The original event that triggered the unselection.
nodeTreeNodeThe unselected node.

Event fired when a node is dropped.

nametypedescription
originalEventDragEventThe original event that triggered the drop.
valueTreeNode[]The value of the tree.
dragNodeTreeNodeThe dragged node.
dropNodeTreeNodeThe drop target node.
indexnumberThe index of the dragged node.
accept() => voidAccept callback for validateDrop mode.

Event fired when drag enters the tree.

nametypedescription
originalEventDragEventThe original event that triggered the drag enter.
valueTreeNode[]The value of the tree.
dragNodeTreeNodeThe dragged node.
dragNodeScopestring | string[]The drag node scope.

Event fired when drag leaves the tree.

nametypedescription
originalEventDragEventThe original event that triggered the drag leave.
valueTreeNode[]The value of the tree.
dragNodeTreeNodeThe dragged node.
dragNodeScopestring | string[]The drag node scope.

Event fired when the tree value changes (for drag-drop).

nametypedescription
valueTreeNode[]The new value.

Types#

Instance of useTree headless.

values
HeadlessInstance<useTreeProps, useTreeState, useTreeExposes>