Tree
A collapsible, hierarchical list for organizing nested items like folders and files.
Folder 1
Folder 2
Folder 3
Installation
Examples
Group
Custom Tree Item
API Reference
TreeList
A TreeList
is a generic component TreeList<T>
, where T
extends TreeItemData
.
Prop | Type | Default | Description |
---|---|---|---|
level | number | 0 | Current tree depth. |
nodes * | TreeNode<T>[] | - | The recursive tree list data. |
defaultIcon | IconInfo | - | Default icon for tree item. |
showEmptyChild | boolean | false | Whether the empty child should be displayed. |
selectedId | string | null | - | The focused tree item ID. |
onSelect | (id: string) => void | - | Handler that is called when a tree item is focused. |
Item | (props: TreeItemProps<T>) => React.ReactNode | TreeItem | A custom renderer for each tree item. |
TreeGroup
Prop | Type | Default | Description |
---|---|---|---|
title * | string | - | The name of the group. |
description | string | - | The description of the group that will be shown as a tooltip. |
isLoading | boolean | - | Whether the group is loading. |
children | React.ReactNode | - | |
onCreate | () => void | - | Handler that is called when the "➕" button is clicked. |
TreeItem
A TreeItem
is a generic component TreeItem<T>
, where T
extends TreeItemData
.
Prop | Type | Default | Description |
---|---|---|---|
node * | T | - | The item data. |
level | number | 0 | The current depth of the item in the tree. |
expandable | boolean | - | Whether the item is expandable. |
expanded | boolean | - | Whether the item is expanded. |
isSelected | boolean | - | Whether the item is focused. |
children | React.ReactNode | - | |
onSelect | () => void | - | Handler that is called when the item is focused. |
onExpand | () => void | - | Handler that is called when the expand/collapse icon is clicked. |
type
TreeItemData
Prop | Type | Default | Description |
---|---|---|---|
id * | string | - | The ID of the tree item. |
nodes * | string | - | The name of the tree item. |
parentId | string | null | - | The ID of its parent. |
icon | IconData | - | The icon of the tree item. |
group | string | null | - | The group the item belongs to. |
type
TreeNode
A tree node is simply a tree item with its children.