Usage
Basic usage of TreeView with hierarchical data.
TreeView component for displaying hierarchical data, such as file systems or organizational charts.
Experiment with the TreeView component properties.
Style of the connection lines.
Size of the tree items.
Render as a directory structure (folder icons).
Show connection lines between nodes.
Basic usage of TreeView with hierarchical data.
Use isDirectory prop to render the tree as a file system structure with folder icons.
Enable connection lines with showLines and customize their style with styleLines.
You can provide custom icons for each node in the data structure.
Manage selection state with selectedId and onNodeSelect.
Use defaultExpanded to specify which nodes should be expanded initially.
Customize how node labels are rendered using the renderLabel prop.
Prop | Default | Type |
|---|---|---|
data | undefined | TreeNode[] |
defaultExpanded | undefined | string[] |
selectedId | undefined | string |
onNodeSelect | undefined | (id: string) => void |
size | "medium" | "small" | "medium" | "large" |
isDirectory | false | boolean |
showLines | false | boolean |
styleLines | "solid" | "solid" | "dashed" | "dotted" |
renderLabel | undefined | (node: TreeNode) => ReactNode |