Skip to main content

Tree

Tree displays hierarchical data as an expandable and collapsible structure. Users can navigate nested items and optionally select one or more nodes.

Also known as: Tree view
Salt package@salt-ds/core
Available since1.63.0

Tree uses a composition model using TreeNode components within a Tree component to define hierarchy.

  • Each TreeNode requires a unique value prop. This value identifies the node for expansion, selection, and disabled state tracking. Ensure values are unique across the entire tree.
  • Use uncontrolled mode with defaultExpanded and defaultSelected for simple use cases, or controlled mode with expanded and selected props when you need to manage state externally.

See the examples for feature demonstrations including icons, multiselect, and disabled nodes.

  • To display hierarchical data with parent-child relationships, such as file systems, organizational structures or category taxonomies.
  • When users need to explore a multi-level hierarchy, browse nested levels and optionally select items, while allowing multiple branches to remain open.
  • For navigation between pages or routes. Instead, use VerticalNavigation.
  • For flat, non-hierarchical lists. Instead, use ListBox.

To import Tree, TreeNode and related component from the core Salt package, use:

import { Tree, TreeNode, TreeNodeTrigger, TreeNodeLabel } from "@salt-ds/core";