<TreeViewdefaultCollapseIcon={<ArrowDown />}defaultExpandIcon={<ArrowRight />}><TreeItem nodeId="1" label="Applications"><TreeItem nodeId="2" label="Calendar" /><TreeItem nodeId="3" label="Chrome" /><TreeItem nodeId="4" label="Webstorm" /></TreeItem><TreeItem nodeId="5" label="Documents"><TreeItem nodeId="10" label="OSS" /><TreeItem nodeId="6" label="Material-UI"><TreeItem nodeId="7" label="src"><TreeItem nodeId="8" label="index.js" /><TreeItem nodeId="9" label="tree-view.js" /></TreeItem></TreeItem></TreeItem></TreeView>
Prop | Type | Default | Description |
---|---|---|---|
children | node | The content of the component. | |
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
defaultCollapseIcon | node | The default icon used to collapse the node. | |
defaultEndIcon | node | The default icon displayed next to a end node. This is applied to all tree nodes and can be overridden by the TreeItem icon prop. | |
defaultExpanded | Array<string> | [] | Expanded node ids. (Uncontrolled). |
defaultExpandIcon | node | The default icon used to expand the node. | |
defaultParentIcon | node | The default icon displayed next to a parent node. This is applied to all parent nodes and can be overridden by the TreeItem icon prop. | |
defaultSelected | Array<string> | string | [] | Selected node ids. (Uncontrolled) When multiSelect is true this takes an array of strings; when false (default) a string. |
disableSelection | bool | false | If true selection is disabled. |
expanded | Array<string> | false | Expanded node ids. (Controlled). |
multiSelect | bool | false | If true ctrl and shift will trigger multiselect. |
onNodeSelect | func | 'medium' | Callback fired when tree items are selected/unselected. Signature:function(event: object, value: array | string) => void event: The event source of the callback value: of the selected nodes. When multiSelect is true this is an array of strings; when false (default) a string. |
onNodeToggle | func | Callback fired when tree items are expanded/collapsed. Signature:function(event: object, nodeIds: array) => void event: The event source of the callback.nodeIds: The ids of the expanded nodes. | |
selected | Array<string> | string | Selected node ids. (Controlled) When multiSelect is true this takes an array of strings; when false (default) a string. |