[object Promise]

# RichTreeView API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Tree View - Quickstart](/x/react-tree-view/quickstart/)
- [Rich Tree View - Customization](/x/react-tree-view/rich-tree-view/customization/)
- [Rich Tree View - Label editing](/x/react-tree-view/rich-tree-view/editing/)
- [Rich Tree View - Expansion](/x/react-tree-view/rich-tree-view/expansion/)
- [Rich Tree View - Focus](/x/react-tree-view/rich-tree-view/focus/)
- [Rich Tree View - Items](/x/react-tree-view/rich-tree-view/items/)
- [Rich Tree View - Selection](/x/react-tree-view/rich-tree-view/selection/)
- [Rich Tree View - Virtualization](/x/react-tree-view/rich-tree-view/virtualization/)
- [Tree Item customization](/x/react-tree-view/tree-item-customization/)

## Import

```jsx
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';
// or
import { RichTreeView } from '@mui/x-tree-view';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| items | `array` | - | Yes |  |
| apiRef | `{ current?: { addItems?: func, focusItem?: func, getItem?: func, getItemDOMElement?: func, getItemOrderedChildrenIds?: func, getItemSelection?: func, getItemTree?: func, getParentId?: func, isItemExpanded?: func, setEditedItem?: func, setIsItemDisabled?: func, setItemExpansion?: func, setItemSelection?: func, updateItemLabel?: func } }` | - | No |  |
| checkboxSelection | `bool` | `false` | No |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| defaultExpandedItems | `Array<string>` | `[]` | No |  |
| defaultSelectedItems | `any` | `[]` | No |  |
| disabledItemsFocusable | `bool` | `false` | No |  |
| disableSelection | `bool` | `false` | No |  |
| domStructure | `'flat' \| 'nested'` | `'nested'` | No |  |
| expandedItems | `Array<string>` | - | No |  |
| expansionTrigger | `'content' \| 'iconContainer'` | `'content'` | No |  |
| getItemChildren | `function(item: R) => Array<R>` | `(item) => item.children` | No |  |
| getItemId | `function(item: R) => TreeViewItemId` | `(item) => item.id` | No |  |
| getItemLabel | `function(item: R) => string` | `(item) => item.label` | No |  |
| id | `string` | - | No |  |
| isItemDisabled | `function(item: R) => boolean` | - | No |  |
| isItemEditable | `func \| bool` | `() => false` | No |  |
| isItemSelectionDisabled | `function(item: R) => boolean` | - | No |  |
| itemChildrenIndentation | `number \| string` | `12px` | No |  |
| itemHeight | `number` | `null` | No |  |
| loading | `bool` | `false` | No |  |
| multiSelect | `bool` | `false` | No |  |
| onExpandedItemsChange | `function(event: React.SyntheticEvent, itemIds: Array<TreeViewItemId>) => void` | - | No |  |
| onItemClick | `function(event: React.MouseEvent, itemId: TreeViewItemId) => void` | - | No |  |
| onItemExpansionToggle | `function(event: React.SyntheticEvent \| null, itemId: TreeViewItemId, isExpanded: boolean) => void` | - | No |  |
| onItemFocus | `function(event: React.SyntheticEvent \| null, itemId: TreeViewItemId) => void` | - | No |  |
| onItemLabelChange | `function(itemId: TreeViewItemId, newLabel: string) => void` | - | No |  |
| onItemSelectionToggle | `function(event: React.SyntheticEvent, itemId: TreeViewItemId, isSelected: boolean) => void` | - | No |  |
| onSelectedItemsChange | `function(event: React.SyntheticEvent, itemIds: Array<TreeViewItemId> \| TreeViewItemId) => void` | - | No |  |
| selectedItems | `any` | - | No |  |
| selectionPropagation | `{ descendants?: bool, parents?: bool }` | `{ parents: false, descendants: false }` | No |  |
| slotProps | `object` | `{}` | No |  |
| slots | `object` | `{}` | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |

> **Note**: The `ref` is forwarded to the root element (HTMLUListElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiRichTreeView` to change the default props of this component with the theme.

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| root | `RichTreeViewRoot` | `.MuiRichTreeView-root` | Element rendered at the root. |
| loading | `TreeItemLoader rows.` | - | Component rendered instead of the default loading rows.
It renders inside the tree root while the tree is loading, which keeps the
`role="tree"` and `aria-busy` attributes, and inside a lazily loading item
while its children load.
Compose it with `TreeItemLoader` to keep the rows semantically correct. |
| itemLoader | `TreeItemLoader` | `.MuiRichTreeView-itemLoader` | Component rendered for each loading row.
It also renders for the children of an item while they load lazily.
Wrap custom content in `TreeItemLoader` to keep the row semantically correct. |
| collapseIcon | `TreeViewCollapseIcon` | - | The default icon used to collapse the item. |
| expandIcon | `TreeViewExpandIcon` | - | The default icon used to expand the item. |
| endIcon | `null` | - | The default icon displayed next to an end item.
This is applied to all Tree Items and can be overridden by the TreeItem `icon` slot prop. |
| item | `TreeItem.` | `.MuiRichTreeView-item` | Custom component to render a Tree Item. |

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | itemCheckbox | Styles applied to the item's checkbox element. |
| - | itemContent | Styles applied to the item's content element. |
| - | itemGroupTransition | Styles applied to the item's transition element. |
| - | itemIconContainer | Styles applied to the item's icon container element icon. |
| - | itemLabel | Styles applied to the item's label element. |
| - | itemLabelInput | Styles applied to the item's label input element (visible only when editing is enabled). |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-tree-view/src/RichTreeView/RichTreeView.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-tree-view/src/RichTreeView/RichTreeView.tsx)

# SimpleTreeView API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Tree View - Quickstart](/x/react-tree-view/quickstart/)
- [Simple Tree View - Customization](/x/react-tree-view/simple-tree-view/customization/)
- [Simple Tree View - Expansion](/x/react-tree-view/simple-tree-view/expansion/)
- [Simple Tree View - Focus](/x/react-tree-view/simple-tree-view/focus/)
- [Simple Tree View - Items](/x/react-tree-view/simple-tree-view/items/)
- [Simple Tree View - Selection](/x/react-tree-view/simple-tree-view/selection/)
- [Tree Item customization](/x/react-tree-view/tree-item-customization/)

## Import

```jsx
import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView';
// or
import { SimpleTreeView } from '@mui/x-tree-view';
// or
import { SimpleTreeView } from '@mui/x-tree-view-pro';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| apiRef | `{ current?: { focusItem?: func, getItem?: func, getItemDOMElement?: func, getItemOrderedChildrenIds?: func, getItemSelection?: func, getItemTree?: func, getParentId?: func, isItemExpanded?: func, setIsItemDisabled?: func, setItemExpansion?: func, setItemSelection?: func } }` | - | No |  |
| checkboxSelection | `bool` | `false` | No |  |
| children | `node` | - | No |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| defaultExpandedItems | `Array<string>` | `[]` | No |  |
| defaultSelectedItems | `any` | `[]` | No |  |
| disabledItemsFocusable | `bool` | `false` | No |  |
| disableSelection | `bool` | `false` | No |  |
| expandedItems | `Array<string>` | - | No |  |
| expansionTrigger | `'content' \| 'iconContainer'` | `'content'` | No |  |
| id | `string` | - | No |  |
| itemChildrenIndentation | `number \| string` | `12px` | No |  |
| itemHeight | `number` | `null` | No |  |
| multiSelect | `bool` | `false` | No |  |
| onExpandedItemsChange | `function(event: React.SyntheticEvent, itemIds: Array<TreeViewItemId>) => void` | - | No |  |
| onItemClick | `function(event: React.MouseEvent, itemId: TreeViewItemId) => void` | - | No |  |
| onItemExpansionToggle | `function(event: React.SyntheticEvent \| null, itemId: TreeViewItemId, isExpanded: boolean) => void` | - | No |  |
| onItemFocus | `function(event: React.SyntheticEvent \| null, itemId: TreeViewItemId) => void` | - | No |  |
| onItemSelectionToggle | `function(event: React.SyntheticEvent, itemId: TreeViewItemId, isSelected: boolean) => void` | - | No |  |
| onSelectedItemsChange | `function(event: React.SyntheticEvent, itemIds: Array<TreeViewItemId> \| TreeViewItemId) => void` | - | No |  |
| selectedItems | `any` | - | No |  |
| selectionPropagation | `{ descendants?: bool, parents?: bool }` | `{ parents: false, descendants: false }` | No |  |
| slotProps | `object` | - | No |  |
| slots | `object` | - | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |

> **Note**: The `ref` is forwarded to the root element (HTMLUListElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiSimpleTreeView` to change the default props of this component with the theme.

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| root | `SimpleTreeViewRoot` | `.MuiSimpleTreeView-root` | Element rendered at the root. |
| collapseIcon | `TreeViewCollapseIcon` | - | The default icon used to collapse the item. |
| expandIcon | `TreeViewExpandIcon` | - | The default icon used to expand the item. |
| endIcon | `null` | - | The default icon displayed next to an end item.
This is applied to all Tree Items and can be overridden by the TreeItem `icon` slot prop. |

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | item | Styles applied to the item's root element. |
| - | itemCheckbox | Styles applied to the item's checkbox element. |
| - | itemContent | Styles applied to the item's content element. |
| - | itemGroupTransition | Styles applied to the item's transition element. |
| - | itemIconContainer | Styles applied to the item's icon container element icon. |
| - | itemLabel | Styles applied to the item's label element. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-tree-view/src/SimpleTreeView/SimpleTreeView.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-tree-view/src/SimpleTreeView/SimpleTreeView.tsx)

# TreeItem API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Tree View - Quickstart](/x/react-tree-view/quickstart/)
- [Rich Tree View - Customization](/x/react-tree-view/rich-tree-view/customization/)
- [Rich Tree View - Label editing](/x/react-tree-view/rich-tree-view/editing/)
- [Rich Tree View - Expansion](/x/react-tree-view/rich-tree-view/expansion/)
- [Rich Tree View - Focus](/x/react-tree-view/rich-tree-view/focus/)
- [Rich Tree View - Items](/x/react-tree-view/rich-tree-view/items/)
- Rich Tree View - Lazy loading
- Rich Tree View - Ordering
- [Rich Tree View - Selection](/x/react-tree-view/rich-tree-view/selection/)
- [Rich Tree View - Virtualization](/x/react-tree-view/rich-tree-view/virtualization/)
- [Simple Tree View - Customization](/x/react-tree-view/simple-tree-view/customization/)
- [Simple Tree View - Expansion](/x/react-tree-view/simple-tree-view/expansion/)
- [Simple Tree View - Focus](/x/react-tree-view/simple-tree-view/focus/)
- [Simple Tree View - Items](/x/react-tree-view/simple-tree-view/items/)
- [Simple Tree View - Selection](/x/react-tree-view/simple-tree-view/selection/)
- [Tree Item customization](/x/react-tree-view/tree-item-customization/)

## Import

```jsx
import { TreeItem } from '@mui/x-tree-view/TreeItem';
// or
import { TreeItem } from '@mui/x-tree-view';
// or
import { TreeItem } from '@mui/x-tree-view-pro';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| itemId | `string` | - | Yes |  |
| children | `any` | - | No |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| disabled | `bool` | `false` | No |  |
| disableSelection | `bool` | `false` | No |  |
| id | `string` | - | No |  |
| label | `node` | - | No |  |
| onBlur | `func` | - | No |  |
| onFocus | `unsupportedProp` | - | No |  |
| onKeyDown | `func` | - | No |  |
| slotProps | `object` | `{}` | No |  |
| slots | `object` | `{}` | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |

> **Note**: The `ref` is forwarded to the root element (HTMLLIElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiTreeItem` to change the default props of this component with the theme.

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| root | `TreeItemRoot` | `.MuiTreeItem-root` | The component that renders the root. |
| content | `TreeItemContent` | `.MuiTreeItem-content` | The component that renders the content of the item.
(e.g.: everything related to this item, not to its children). |
| groupTransition | `TreeItemGroupTransition` | `.MuiTreeItem-groupTransition` | The component that renders the children of the item. |
| iconContainer | `TreeItemIconContainer` | `.MuiTreeItem-iconContainer` | The component that renders the icon. |
| checkbox | `TreeItemCheckbox` | `.MuiTreeItem-checkbox` | The component that renders the item checkbox for selection. |
| label | `TreeItemLabel` | `.MuiTreeItem-label` | The component that renders the item label. |
| labelInput | `TreeItemLabelInput` | `.MuiTreeItem-labelInput` | The component that renders the input to edit the label when the item is editable and is currently being edited. |
| dragAndDropOverlay | `TreeItemDragAndDropOverlay` | `.MuiTreeItem-dragAndDropOverlay` | The component that renders the overlay when an item reordering is ongoing.
Warning: This slot is only useful when using the `` component. |
| errorIcon | `TreeItemErrorContainer` | `.MuiTreeItem-errorIcon` | The component that is rendered when the item is in an error state.
Warning: This slot is only useful when using the `` component is lazy loading is enabled. |
| loadingIcon | `TreeItemLoadingContainer` | `.MuiTreeItem-loadingIcon` | The component that is rendered when the item is in a loading state.
Warning: This slot is only useful when using the `` component is lazy loading is enabled. |
| collapseIcon | `The `collapseIcon` slot of the Tree View.` | - | The icon used to collapse the item. |
| expandIcon | `The `expandIcon` slot of the Tree View.` | - | The icon used to expand the item. |
| endIcon | `The `endIcon` slot of the Tree View.` | - | The icon displayed next to an end item. |
| icon | `null` | - | The icon to display next to the Tree Item's label. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-tree-view/src/TreeItem/TreeItem.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-tree-view/src/TreeItem/TreeItem.tsx)