SimpleTreeView API
API reference docs for the React SimpleTreeView component. Learn about the props, CSS, and other APIs of this exported module.
Component demos
Import
import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView';
// or
import { SimpleTreeView } from '@mui/x-tree-view';Props of the native component are also available.
Override or extend the styles applied to the component.
See CSS API below for more details.
Type:object
Expanded node ids. Used when the item's expansion is not controlled.
Type:Array<string>
Default:[]
Selected node ids. (Uncontrolled) When multiSelect is true this takes an array of strings; when false (default) a string.
Type:any
Default:[]
This prop is used to help implement the accessibility logic. If you don't provide this prop. It falls back to a randomly generated id.
Type:string
Callback fired when tree items are expanded/collapsed.
Type:func
function(event: React.SyntheticEvent, nodeIds: array) => voideventThe event source of the callback.nodeIdsThe ids of the expanded nodes.
Callback fired when a tree item is expanded or collapsed.
Type:func
function(event: React.SyntheticEvent, nodeId: array, isExpanded: array) => voideventThe event source of the callback.nodeIdThe nodeId of the modified node.isExpandedtrueif the node has just been expanded,falseif it has just been collapsed.
Callback fired when tree items are focused.
Type:func
function(event: React.SyntheticEvent, nodeId: string, value: string) => voideventThe event source of the callback Warning: This is a generic event not a focus event.nodeIdThe id of the node focused.valueof the focused node.
Callback fired when a tree item is selected or deselected.
Type:func
function(event: React.SyntheticEvent, nodeId: array, isSelected: array) => voideventThe event source of the callback.nodeIdThe nodeId of the modified node.isSelectedtrueif the node has just been selected,falseif it has just been deselected.
Callback fired when tree items are selected/deselected.
Type:func
function(event: React.SyntheticEvent, nodeIds: Array | string) => void eventThe event source of the callbacknodeIdsThe ids of the selected nodes. WhenmultiSelectistrue, this is an array of strings; when false (default) a string.
Selected node ids. (Controlled) When multiSelect is true this takes an array of strings; when false (default) a string.
Type:any
The system prop that allows defining system overrides as well as additional CSS styles.
See the `sx` page for more details.
Type:Array<func
| object
| bool>
| func
| object
ref is forwarded to the root element.Theme default props
You can use MuiSimpleTreeView to change the default props of this component with the theme.
Element rendered at the root.
Class name: .MuiSimpleTreeView-root
Default component: SimpleTreeViewRoot