Tree
Tree displays hierarchical data as an expandable and collapsible structure. Users can navigate nested items and optionally select one or more nodes.
| Salt package | @salt-ds/core |
|---|---|
| Available since | 1.63.0 |
The default Tree displays a collapsible hierarchy with single selection. Click a node to select it, or click the expand icon to reveal child nodes.
Use the icon prop on TreeNode to display an icon alongside the label. Icons help users quickly identify the type of content each node represents.
- Only use icons when they provide meaningful context to help users identify node types.
- Apply icons to all nodes or none for visual consistency. Mixing nodes with and without icons creates an unbalanced visual hierarchy.
- Use consistent icons for similar node types (e.g., folder icons for parent nodes, document icons for leaf nodes).
- Icons in a tree are decorative. Ensure that any information conveyed by icons is also available via the node label.
Set multiselect to enable multiple node selection with checkboxes. This provides a clear visual indication of selection state and supports parent-child selection propagation.
- Use checkbox selection when users need to select multiple items for a bulk action.
- Selecting a parent node automatically selects all its children, and selecting all children automatically selects the parent.
Use the disabled prop on individual TreeNode components to disable specific nodes. Disabled nodes cannot be selected, expanded, or interacted with.
Use the TreeNodeTrigger and TreeNodeLabel components to wrap tree node content with a tooltip. This allows you to provide additional context or descriptions for nodes on hover and focus.
- Use tooltips to provide supplementary information. See Tooltip for more information on usage.