Side Nav

import {SideNav} from "@qualcomm-ui/react/side-nav"

Overview

The side nav is an extension of our tree component.

  • The Side Navigation relies on the TreeCollection class to manage its items. Refer to the API below for details.
  • Like with the tree, Side Navigations are composed of nodes, which are objects that describe the navigation SideNav. There are two types of nodes:
  • A branch node has children.
  • A leaf node does not have any children.
  • Each node has a value (unique identifier used for expansion) and a text (display text).

Default object shape:

  • value (required): unique identifier for expansion/selection
  • text (required): display text
  • nodes (optional): child nodes for branches
  • disabled (optional): prevents interaction when true

These keys can be customized via the TreeCollection constructor.

Examples

Node Shorthand

We expose the <SideNav.Nodes> shorthand for rendering nodes. Use its renderBranch and renderLeaf render props to customize the content of each tree node.

Note that <SideNav.Nodes> automatically renders child nodes for branches, so you only have to customize the content of the node itself.

Qualcomm
Notifications
Dashboard
AI Studio

Grouping

Group nodes using the collection's groupChildren method. This should be called on the top-level node of your SideNav. Nested groups are not supported.

Qualcomm
Notifications
Settings
Main menu
Dashboard
AI Studio
Data Analysis
Administration
Profile
Security
Billing

Default Expanded

Expand nodes by default using the defaultExpandedValue prop. Or use expandedValue and onExpandedChange to control the expansion manually. These props follow our controlled state pattern.

Qualcomm
Notifications
Dashboard
AI Studio
Account
Profile
Security
Billing
<SideNav.Root collection={collection} defaultExpandedValue={["account"]}>

Disabled Nodes

You can disable nodes by setting the disabled property on the node object.

Qualcomm
Notifications
Dashboard
AI Studio
Account
Profile
Security
Billing

Filtering

Here's an example that filters the items using matchSorter.

Qualcomm
Notifications
Settings
Main menu
Dashboard
AI Studio
Data Analysis
Administration
Profile
Security
Billing

Side Nav nodes can be links using polymorphic composition. Use the render prop on the <SideNav.LeafNode> to specify the element type.

Qualcomm
<SideNav.LeafNode
  render={node.pathname ? <Link to={node.pathname} /> : <div />}
>
  <SideNav.NodeIndicator />
  {node.icon ? <SideNav.NodeIcon icon={node.icon} /> : null}
  <SideNav.NodeText>{node.text}</SideNav.NodeText>
</SideNav.LeafNode>

Collapsed

Side Nav can be collapsed to render only the top-level icons.

The open state of the panel can be controlled using the open, onOpenChange and defaultOpen props. These props follow our controlled state pattern.

Notifications
Settings
Main menu
Dashboard
AI Studio
Data Analysis
Administration
Profile
Security
Billing

API

<SideNav.Root>

PropTypeDefault
The tree collection data
The initial expanded node ids when rendered. Use when you don't need to control the expanded node value.
string[]
The initial focused node value when rendered. Use when you don't need to control the focused node value.
string
The initial open state of the side navigation when rendered. Use when you don't need to control the open state of the collapsible.
boolean
true
The initial selected node value when rendered. Use when you don't need to control the selected node value.
string[]
The document's text/writing direction.
'ltr' | 'rtl'
'ltr'
Whether the collapsible is disabled.
boolean
The controlled expanded node ids
string[]
Whether clicking on a branch should open it or not
boolean
true
The value of the focused node
string
A root node to correctly resolve document in custom environments. i.e., Iframes, Electron.
      () =>
      | Node
      | ShadowRoot
      | Document
      id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
      string
      When true, the component will not be rendered in the DOM until it becomes visible or active.
      boolean
      false
      
      Function to load children for a node asynchronously. When provided, branches will wait for this promise to resolve before expanding.
          (details: {
          indexPath: number[]
          node: T
          signal: AbortSignal
          valuePath: string[]
          }) => Promise<Array<T>>
          Called when the tree is opened or closed
              (details: {
              expandedNodes: Array<T>
              expandedValue: string[]
              focusedValue: string
              }) => void
              Called when the focused node changes
                  (details: {
                  focusedNode: T
                  focusedValue: string
                  }) => void
                  Called when a node finishes loading children
                      (details: {
                      collection: TreeCollection<T>
                      }) => void
                      Called when loading children fails for one or more nodes
                          (details: {
                          nodes: NodeWithError[]
                          }) => void
                          Function invoked when the collapsible opens or closes
                          • openThe next value.
                            (
                            open: boolean,
                            ) => void
                            Called when the selection changes
                                (details: {
                                focusedValue: string
                                selectedNodes: Array<T>
                                selectedValue: string[]
                                }) => void
                                The controlled open state of the collapsible
                                boolean
                                Allows you to replace the component's HTML element with a different tag or component. Learn more
                                | ReactElement
                                | ((
                                props: object,
                                ) => ReactElement)
                                The controlled selected node value
                                string[]
                                Whether the tree supports multiple selection
                                • 'single': only one node can be selected
                                • 'multiple': multiple nodes can be selected
                                | 'multiple'
                                | 'single'
                                'single'
                                
                                Callback function that determines whether a node should be hidden.
                                    (
                                    state: NodeState<T>,
                                    ) => boolean
                                    The background color of the side navigation.
                                    | 'primary'
                                    | 'secondary'
                                    'primary'
                                    
                                    Whether the tree supports typeahead search
                                    boolean
                                    true
                                    
                                    When true, the component will be completely removed from the DOM when it becomes inactive or hidden, rather than just being hidden with CSS.
                                    boolean
                                    false
                                    
                                    Description
                                    The tree collection data
                                    Type
                                    string[]
                                    Description
                                    The initial expanded node ids when rendered. Use when you don't need to control the expanded node value.
                                    Type
                                    string
                                    Description
                                    The initial focused node value when rendered. Use when you don't need to control the focused node value.
                                    Type
                                    boolean
                                    Description
                                    The initial open state of the side navigation when rendered. Use when you don't need to control the open state of the collapsible.
                                    Type
                                    string[]
                                    Description
                                    The initial selected node value when rendered. Use when you don't need to control the selected node value.
                                    Type
                                    'ltr' | 'rtl'
                                    Description
                                    The document's text/writing direction.
                                    Type
                                    boolean
                                    Description
                                    Whether the collapsible is disabled.
                                    Type
                                    string[]
                                    Description
                                    The controlled expanded node ids
                                    Type
                                    boolean
                                    Description
                                    Whether clicking on a branch should open it or not
                                    Type
                                    string
                                    Description
                                    The value of the focused node
                                    Type
                                    () =>
                                    | Node
                                    | ShadowRoot
                                    | Document
                                    Description
                                    A root node to correctly resolve document in custom environments. i.e., Iframes, Electron.
                                        Type
                                        string
                                        Description
                                        id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
                                        Type
                                        boolean
                                        Description
                                        When true, the component will not be rendered in the DOM until it becomes visible or active.
                                        Type
                                        (details: {
                                        indexPath: number[]
                                        node: T
                                        signal: AbortSignal
                                        valuePath: string[]
                                        }) => Promise<Array<T>>
                                        Description
                                        Function to load children for a node asynchronously. When provided, branches will wait for this promise to resolve before expanding.
                                            Type
                                            (details: {
                                            expandedNodes: Array<T>
                                            expandedValue: string[]
                                            focusedValue: string
                                            }) => void
                                            Description
                                            Called when the tree is opened or closed
                                                Type
                                                (details: {
                                                focusedNode: T
                                                focusedValue: string
                                                }) => void
                                                Description
                                                Called when the focused node changes
                                                    Type
                                                    (details: {
                                                    collection: TreeCollection<T>
                                                    }) => void
                                                    Description
                                                    Called when a node finishes loading children
                                                        Type
                                                        (details: {
                                                        nodes: NodeWithError[]
                                                        }) => void
                                                        Description
                                                        Called when loading children fails for one or more nodes
                                                            Type
                                                            (
                                                            open: boolean,
                                                            ) => void
                                                            Description
                                                            Function invoked when the collapsible opens or closes
                                                            • openThe next value.
                                                              Type
                                                              (details: {
                                                              focusedValue: string
                                                              selectedNodes: Array<T>
                                                              selectedValue: string[]
                                                              }) => void
                                                              Description
                                                              Called when the selection changes
                                                                  Type
                                                                  boolean
                                                                  Description
                                                                  The controlled open state of the collapsible
                                                                  Type
                                                                  | ReactElement
                                                                  | ((
                                                                  props: object,
                                                                  ) => ReactElement)
                                                                  Description
                                                                  Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                  Type
                                                                  string[]
                                                                  Description
                                                                  The controlled selected node value
                                                                  Type
                                                                  | 'multiple'
                                                                  | 'single'
                                                                  Description
                                                                  Whether the tree supports multiple selection
                                                                  • 'single': only one node can be selected
                                                                  • 'multiple': multiple nodes can be selected
                                                                  Type
                                                                  (
                                                                  state: NodeState<T>,
                                                                  ) => boolean
                                                                  Description
                                                                  Callback function that determines whether a node should be hidden.
                                                                      Type
                                                                      | 'primary'
                                                                      | 'secondary'
                                                                      Description
                                                                      The background color of the side navigation.
                                                                      Type
                                                                      boolean
                                                                      Description
                                                                      Whether the tree supports typeahead search
                                                                      Type
                                                                      boolean
                                                                      Description
                                                                      When true, the component will be completely removed from the DOM when it becomes inactive or hidden, rather than just being hidden with CSS.

                                                                      <SideNav.Nodes>

                                                                      A helper component that renders recursive tree nodes. Doesn't render its own HTML element.
                                                                      PropTypeDefault
                                                                      The index path of the tree node
                                                                      number[]
                                                                      The tree node to apply context from.
                                                                      T
                                                                      Render Prop for the tree's branch items. Use this prop to supply the content of the branch item like the text, indicator, or icon.
                                                                      Render Prop for the tree's leaf items. Use this prop to supply the content of the leaf item like the text, indicator, or icon.
                                                                      Props passed to the branch indent guide component. Only applicable when showIndentGuide is true.
                                                                      TreeBranchIndentGuideProps
                                                                      Whether to render the indent guide for branch child nodes.
                                                                      boolean
                                                                      false
                                                                      
                                                                      Type
                                                                      number[]
                                                                      Description
                                                                      The index path of the tree node
                                                                      Type
                                                                      T
                                                                      Description
                                                                      The tree node to apply context from.
                                                                      Description
                                                                      Render Prop for the tree's branch items. Use this prop to supply the content of the branch item like the text, indicator, or icon.
                                                                      Description
                                                                      Render Prop for the tree's leaf items. Use this prop to supply the content of the leaf item like the text, indicator, or icon.
                                                                      Type
                                                                      TreeBranchIndentGuideProps
                                                                      Description
                                                                      Props passed to the branch indent guide component. Only applicable when showIndentGuide is true.
                                                                      Type
                                                                      boolean
                                                                      Description
                                                                      Whether to render the indent guide for branch child nodes.

                                                                      TreeCollection

                                                                      Note that the TreeCollection accepts a single generic type parameter, T, which is the object type of the node used in the collection.

                                                                      Constructor

                                                                      The constructor of the TreeCollection class accepts the following options:

                                                                      PropTypeDefault
                                                                      Property key for accessing a node's children.
                                                                      keyof T
                                                                      "nodes"
                                                                      
                                                                      Function to determine the count of a node's children.
                                                                          (
                                                                          node: T,
                                                                          ) => number
                                                                          Property key or function to determine if a node is disabled. When a string key is provided, the value of node[key] determines the disabled state.
                                                                          | keyof T
                                                                          | ((node: T) => boolean)
                                                                          "disabled"
                                                                          
                                                                          Property key or function for getting a node's text. When a string key is provided, the value of node[key] is used.
                                                                          | keyof T
                                                                          | ((node: T) => string)
                                                                          "text"
                                                                          
                                                                          Property key or function for getting a node's value. When a string key is provided, the value of node[key] is used.
                                                                          | keyof T
                                                                          | ((node: T) => string)
                                                                          "value"
                                                                          
                                                                          The root node of the tree
                                                                          T
                                                                          Type
                                                                          keyof T
                                                                          Description
                                                                          Property key for accessing a node's children.
                                                                          Type
                                                                          (
                                                                          node: T,
                                                                          ) => number
                                                                          Description
                                                                          Function to determine the count of a node's children.
                                                                              Type
                                                                              | keyof T
                                                                              | ((node: T) => boolean)
                                                                              Description
                                                                              Property key or function to determine if a node is disabled. When a string key is provided, the value of node[key] determines the disabled state.
                                                                              Type
                                                                              | keyof T
                                                                              | ((node: T) => string)
                                                                              Description
                                                                              Property key or function for getting a node's text. When a string key is provided, the value of node[key] is used.
                                                                              Type
                                                                              | keyof T
                                                                              | ((node: T) => string)
                                                                              Description
                                                                              Property key or function for getting a node's value. When a string key is provided, the value of node[key] is used.
                                                                              Type
                                                                              T
                                                                              Description
                                                                              The root node of the tree
                                                                              PropType
                                                                              Gets the node at the specified index path.
                                                                              • indexPathArray of indices representing the path to the node
                                                                                (
                                                                                indexPath: number[],
                                                                                ) => T
                                                                                Checks if a parent index path contains a child index path.
                                                                                • parentIndexPathThe parent path
                                                                                • valueIndexPathThe child path to check
                                                                                  (
                                                                                  parentIndexPath: number[],
                                                                                  valueIndexPath: number[],
                                                                                  ) => boolean
                                                                                  Creates a new tree collection with the same options but different root node.
                                                                                  • rootNodeThe new root node for the copied collection
                                                                                    (
                                                                                    rootNode: T,
                                                                                    ) => any
                                                                                    Filters the tree keeping only nodes that match the predicate.
                                                                                    • predicateFunction to test each node
                                                                                      (
                                                                                      predicate: (
                                                                                      node: T,
                                                                                      indexPath: number[],
                                                                                      ) => boolean,
                                                                                      ) => any
                                                                                      Finds the first node with the specified value.
                                                                                      • valueThe value to search for
                                                                                      • rootNodeThe root node to start searching from
                                                                                        (
                                                                                        value: string,
                                                                                        rootNode?: T,
                                                                                        ) => T
                                                                                        (
                                                                                        predicate: (
                                                                                        node: T,
                                                                                        indexPath: number[],
                                                                                        ) => boolean,
                                                                                        rootNode?: T,
                                                                                        ) => T
                                                                                        Finds all nodes with values matching the provided array.
                                                                                        • valuesArray of values to search for
                                                                                        • rootNodeThe root node to start searching from
                                                                                          (
                                                                                          values: string[],
                                                                                          rootNode?: T,
                                                                                          ) => Array<T>
                                                                                          Flattens the tree into an array with parent/child relationships.
                                                                                          • rootNodeThe root node to start flattening from
                                                                                            (
                                                                                            rootNode?: T,
                                                                                            ) => Array<
                                                                                            T & {
                                                                                            _children: number[]
                                                                                            _index: number
                                                                                            _parent: number
                                                                                            }
                                                                                            >
                                                                                            Gets all branch node values with optional depth filtering.
                                                                                            • rootNodeThe root node to start from
                                                                                            • optsOptions for skipping nodes and filtering by depth
                                                                                              (
                                                                                              rootNode?: T,
                                                                                              opts?: {
                                                                                              skip?: (args: {
                                                                                              indexPath: number[]
                                                                                              node: T
                                                                                              value: string
                                                                                              }) => boolean | void
                                                                                              } & {
                                                                                              depth?:
                                                                                              | number
                                                                                              | ((
                                                                                              nodeDepth: number,
                                                                                              ) => boolean)
                                                                                              },
                                                                                              ) => string[]
                                                                                              Gets the depth of a node with the specified value.
                                                                                              • valueThe value to find the depth for
                                                                                                (
                                                                                                value: string,
                                                                                                ) => number
                                                                                                Gets all descendant nodes of the specified node.
                                                                                                • valueOrIndexPathEither a node value or index path
                                                                                                • optionsOptions for controlling which descendants to include
                                                                                                  (
                                                                                                  valueOrIndexPath?:
                                                                                                  | string
                                                                                                  | number[],
                                                                                                  options?: T & {
                                                                                                  disabled?: boolean
                                                                                                  id?: string
                                                                                                  onUnregister?: (
                                                                                                  index: number,
                                                                                                  ) => void
                                                                                                  requireContext?: boolean
                                                                                                  },
                                                                                                  ) => Array<T>
                                                                                                  Gets all descendant values of the specified node.
                                                                                                  • valueOrIndexPathEither a node value or index path
                                                                                                  • optionsOptions for controlling which descendants to include
                                                                                                    (
                                                                                                    valueOrIndexPath:
                                                                                                    | string
                                                                                                    | number[],
                                                                                                    options?: T & {
                                                                                                    disabled?: boolean
                                                                                                    id?: string
                                                                                                    onUnregister?: (
                                                                                                    index: number,
                                                                                                    ) => void
                                                                                                    requireContext?: boolean
                                                                                                    },
                                                                                                    ) => string[]
                                                                                                    Gets the first non-disabled node in the tree.
                                                                                                    • rootNodeThe root node to start searching from
                                                                                                      (
                                                                                                      rootNode?: T,
                                                                                                      ) => T
                                                                                                      Gets the index path for a node with the specified value.
                                                                                                      • valueThe value to find the index path for
                                                                                                        (
                                                                                                        value: string,
                                                                                                        ) => number[]
                                                                                                        Gets the last non-disabled node in the tree.
                                                                                                        • rootNodeThe root node to start searching from
                                                                                                        • optsOptions for skipping nodes during traversal
                                                                                                          (
                                                                                                          rootNode?: T,
                                                                                                          opts?: {
                                                                                                          skip?: (args: {
                                                                                                          indexPath: number[]
                                                                                                          node: T
                                                                                                          value: string
                                                                                                          }) => boolean | void
                                                                                                          },
                                                                                                          ) => T
                                                                                                          Gets the next node after the one with the specified value.
                                                                                                          • valueThe value to find the next node from
                                                                                                          • optsOptions for skipping nodes during traversal
                                                                                                            (
                                                                                                            value: string,
                                                                                                            opts?: {
                                                                                                            skip?: (args: {
                                                                                                            indexPath: number[]
                                                                                                            node: T
                                                                                                            value: string
                                                                                                            }) => boolean | void
                                                                                                            },
                                                                                                            ) => T
                                                                                                            Gets the next non-disabled sibling of the node at the index path.
                                                                                                            • indexPathArray of indices representing the path to the node
                                                                                                              (
                                                                                                              indexPath: number[],
                                                                                                              ) => T
                                                                                                              Returns all child nodes for this node. Uses options.nodeToChildren if provided, otherwise falls back to default behavior.
                                                                                                                  (
                                                                                                                  node: T,
                                                                                                                  ) => Array<T>
                                                                                                                  Gets the number of children for a node, supporting lazy loading scenarios. Uses options.nodeToChildrenCount if provided, otherwise falls back to default behavior.
                                                                                                                  • nodeThe node to get children count for
                                                                                                                    (
                                                                                                                    node: T,
                                                                                                                    ) => number
                                                                                                                    Checks if a node is disabled. Uses options.isNodeDisabled if provided, otherwise falls back to default behavior.
                                                                                                                    • nodeThe node to check
                                                                                                                      (
                                                                                                                      node: T,
                                                                                                                      ) => boolean
                                                                                                                      Gets the string value for a node. Uses options.nodeValue if provided, otherwise falls back to default behavior.
                                                                                                                      • nodeThe node to get the value from
                                                                                                                        (
                                                                                                                        node: T,
                                                                                                                        ) => string
                                                                                                                        Gets the parent node of the specified node.
                                                                                                                        • valueOrIndexPathEither a node value or index path
                                                                                                                          (
                                                                                                                          valueOrIndexPath:
                                                                                                                          | string
                                                                                                                          | number[],
                                                                                                                          ) => T
                                                                                                                          Gets all parent nodes from root to the specified node.
                                                                                                                          • valueOrIndexPathEither a node value or index path
                                                                                                                            (
                                                                                                                            valueOrIndexPath:
                                                                                                                            | string
                                                                                                                            | number[],
                                                                                                                            ) => Array<T>
                                                                                                                            Gets the previous node before the one with the specified value.
                                                                                                                            • valueThe value to find the previous node from
                                                                                                                            • optsOptions for skipping nodes during traversal
                                                                                                                              (
                                                                                                                              value: string,
                                                                                                                              opts?: {
                                                                                                                              skip?: (args: {
                                                                                                                              indexPath: number[]
                                                                                                                              node: T
                                                                                                                              value: string
                                                                                                                              }) => boolean | void
                                                                                                                              },
                                                                                                                              ) => T
                                                                                                                              Gets the previous non-disabled sibling of the node at the index path.
                                                                                                                              • indexPathArray of indices representing the path to the node
                                                                                                                                (
                                                                                                                                indexPath: number[],
                                                                                                                                ) => T
                                                                                                                                Gets all sibling nodes of the node at the index path.
                                                                                                                                • indexPathArray of indices representing the path to the node
                                                                                                                                  (
                                                                                                                                  indexPath: number[],
                                                                                                                                  ) => Array<T>
                                                                                                                                  Gets the value of the node at the specified index path.
                                                                                                                                  • indexPathArray of indices representing the path to the node
                                                                                                                                    (
                                                                                                                                    indexPath: number[],
                                                                                                                                    ) => string
                                                                                                                                    Gets the path of values from root to the specified index path.
                                                                                                                                    • indexPathArray of indices representing the path to the node
                                                                                                                                      (
                                                                                                                                      indexPath: number[],
                                                                                                                                      ) => string[]
                                                                                                                                      Gets all values in the tree, excluding the root node.
                                                                                                                                      • rootNodeThe root node to start from
                                                                                                                                        (
                                                                                                                                        rootNode?: T,
                                                                                                                                        ) => string[]
                                                                                                                                        Groups children of a parent node by a specified key.
                                                                                                                                        • parentIndexPathIndex path of the parent node whose children to group. Pass [] for root-level children.
                                                                                                                                        • groupByFunction that determines the group key for each child node
                                                                                                                                        • sortGroupsOptional array of group keys defining order, or comparator function to sort the groups. By default, groups are sorted by first occurrence in the tree (insertion order)
                                                                                                                                          (
                                                                                                                                          parentIndexPath: IndexPath,
                                                                                                                                          groupBy: (
                                                                                                                                          node: T,
                                                                                                                                          index: number,
                                                                                                                                          ) => string,
                                                                                                                                          sortGroups?:
                                                                                                                                          | string[]
                                                                                                                                          | ((
                                                                                                                                          a: {
                                                                                                                                          items: Array<{
                                                                                                                                          indexPath: IndexPath
                                                                                                                                          node: T
                                                                                                                                          }>
                                                                                                                                          key: string
                                                                                                                                          },
                                                                                                                                          b: {
                                                                                                                                          items: Array<{
                                                                                                                                          indexPath: IndexPath
                                                                                                                                          node: T
                                                                                                                                          }>
                                                                                                                                          key: string
                                                                                                                                          },
                                                                                                                                          ) => number),
                                                                                                                                          ) => GroupedTreeNode<T>[]
                                                                                                                                          // Group root-level children
                                                                                                                                          const groups = collection.groupChildren([], (node) => node.group ?? 'default')

                                                                                                                                          // Group with explicit order
                                                                                                                                          const groups = collection.groupChildren(
                                                                                                                                          [],
                                                                                                                                          (node) => node.group,
                                                                                                                                          ['primary', 'secondary', 'tertiary']
                                                                                                                                          )

                                                                                                                                          // Group with custom sorter
                                                                                                                                          const groups = collection.groupChildren(
                                                                                                                                          [],
                                                                                                                                          (node) => node.group,
                                                                                                                                          (a, b) => String(a.key).localeCompare(String(b.key))
                                                                                                                                          )
                                                                                                                                          Inserts nodes after the node at the specified index path.
                                                                                                                                          • indexPathArray of indices representing the insertion point
                                                                                                                                          • nodesArray of nodes to insert
                                                                                                                                            (
                                                                                                                                            indexPath: number[],
                                                                                                                                            nodes: Array<T>,
                                                                                                                                            ) => any
                                                                                                                                            Inserts nodes before the node at the specified index path.
                                                                                                                                            • indexPathArray of indices representing the insertion point
                                                                                                                                            • nodesArray of nodes to insert
                                                                                                                                              (
                                                                                                                                              indexPath: number[],
                                                                                                                                              nodes: Array<T>,
                                                                                                                                              ) => any
                                                                                                                                              Checks if a node is a branch node (has children or can have children).
                                                                                                                                              • nodeThe node to check
                                                                                                                                                (
                                                                                                                                                node: T,
                                                                                                                                                ) => boolean
                                                                                                                                                Compares this tree collection with another for deep equality.
                                                                                                                                                • otherThe other tree collection to compare with
                                                                                                                                                  (
                                                                                                                                                  other: TreeCollection<T>,
                                                                                                                                                  ) => boolean
                                                                                                                                                  Checks if a node is the root node.
                                                                                                                                                  • nodeThe node to check
                                                                                                                                                    (
                                                                                                                                                    node: T,
                                                                                                                                                    ) => boolean
                                                                                                                                                    Checks if two nodes are the same by comparing their values.
                                                                                                                                                    • nodeFirst node to compare
                                                                                                                                                    • otherSecond node to compare
                                                                                                                                                      (
                                                                                                                                                      node: T,
                                                                                                                                                      other: T,
                                                                                                                                                      ) => boolean
                                                                                                                                                      Moves nodes from one location to another in the tree.
                                                                                                                                                      • fromIndexPathsArray of index paths to move from
                                                                                                                                                      • toIndexPathIndex path to move to
                                                                                                                                                        (
                                                                                                                                                        fromIndexPaths: Array<
                                                                                                                                                        number[]
                                                                                                                                                        >,
                                                                                                                                                        toIndexPath: number[],
                                                                                                                                                        ) => any
                                                                                                                                                        Removes nodes at the specified index paths.
                                                                                                                                                        • indexPathsArray of index paths to remove
                                                                                                                                                          (
                                                                                                                                                          indexPaths: Array<number[]>,
                                                                                                                                                          ) => any
                                                                                                                                                          Replaces the node at the specified index path.
                                                                                                                                                          • indexPathArray of indices representing the path to the node
                                                                                                                                                          • nodeThe new node to replace with
                                                                                                                                                            (
                                                                                                                                                            indexPath: number[],
                                                                                                                                                            node: T,
                                                                                                                                                            ) => any
                                                                                                                                                            The root tree node.
                                                                                                                                                            T
                                                                                                                                                            Sorts values according to their tree order.
                                                                                                                                                            • valuesArray of values to sort
                                                                                                                                                              (
                                                                                                                                                              values: string[],
                                                                                                                                                              ) => string[]
                                                                                                                                                              Converts a node value to its string representation.
                                                                                                                                                              • valueThe value to stringify
                                                                                                                                                              (
                                                                                                                                                              value: string,
                                                                                                                                                              ) => string
                                                                                                                                                              Converts a node to its string representation. Uses options.nodeLabel if provided, otherwise falls back to default behavior: uses node.text, or node.value if node.text is not available.
                                                                                                                                                              • nodeThe node to stringify
                                                                                                                                                              (
                                                                                                                                                              T,
                                                                                                                                                              ) => string
                                                                                                                                                              Serializes the tree to a JSON-compatible array of values.
                                                                                                                                                                  () => string[]
                                                                                                                                                                  Visits all nodes in the tree with optional skip functionality.
                                                                                                                                                                  • optsOptions for visiting nodes, including skip predicate
                                                                                                                                                                    (opts: {
                                                                                                                                                                    onEnter?: (
                                                                                                                                                                    node: T,
                                                                                                                                                                    indexPath: number[],
                                                                                                                                                                    ) => void | 'skip' | 'stop'
                                                                                                                                                                    onLeave?: (
                                                                                                                                                                    node: T,
                                                                                                                                                                    indexPath: number[],
                                                                                                                                                                    ) => void | 'stop'
                                                                                                                                                                    reuseIndexPath?: boolean
                                                                                                                                                                    skip?: (args: {
                                                                                                                                                                    indexPath: number[]
                                                                                                                                                                    node: T
                                                                                                                                                                    value: string
                                                                                                                                                                    }) => boolean | void
                                                                                                                                                                    }) => void
                                                                                                                                                                    Type
                                                                                                                                                                    (
                                                                                                                                                                    indexPath: number[],
                                                                                                                                                                    ) => T
                                                                                                                                                                    Description
                                                                                                                                                                    Gets the node at the specified index path.
                                                                                                                                                                    • indexPathArray of indices representing the path to the node
                                                                                                                                                                      Type
                                                                                                                                                                      (
                                                                                                                                                                      parentIndexPath: number[],
                                                                                                                                                                      valueIndexPath: number[],
                                                                                                                                                                      ) => boolean
                                                                                                                                                                      Description
                                                                                                                                                                      Checks if a parent index path contains a child index path.
                                                                                                                                                                      • parentIndexPathThe parent path
                                                                                                                                                                      • valueIndexPathThe child path to check
                                                                                                                                                                        Type
                                                                                                                                                                        (
                                                                                                                                                                        rootNode: T,
                                                                                                                                                                        ) => any
                                                                                                                                                                        Description
                                                                                                                                                                        Creates a new tree collection with the same options but different root node.
                                                                                                                                                                        • rootNodeThe new root node for the copied collection
                                                                                                                                                                          Type
                                                                                                                                                                          (
                                                                                                                                                                          predicate: (
                                                                                                                                                                          node: T,
                                                                                                                                                                          indexPath: number[],
                                                                                                                                                                          ) => boolean,
                                                                                                                                                                          ) => any
                                                                                                                                                                          Description
                                                                                                                                                                          Filters the tree keeping only nodes that match the predicate.
                                                                                                                                                                          • predicateFunction to test each node
                                                                                                                                                                            Type
                                                                                                                                                                            (
                                                                                                                                                                            value: string,
                                                                                                                                                                            rootNode?: T,
                                                                                                                                                                            ) => T
                                                                                                                                                                            Description
                                                                                                                                                                            Finds the first node with the specified value.
                                                                                                                                                                            • valueThe value to search for
                                                                                                                                                                            • rootNodeThe root node to start searching from
                                                                                                                                                                              Type
                                                                                                                                                                              (
                                                                                                                                                                              predicate: (
                                                                                                                                                                              node: T,
                                                                                                                                                                              indexPath: number[],
                                                                                                                                                                              ) => boolean,
                                                                                                                                                                              rootNode?: T,
                                                                                                                                                                              ) => T
                                                                                                                                                                              Type
                                                                                                                                                                              (
                                                                                                                                                                              values: string[],
                                                                                                                                                                              rootNode?: T,
                                                                                                                                                                              ) => Array<T>
                                                                                                                                                                              Description
                                                                                                                                                                              Finds all nodes with values matching the provided array.
                                                                                                                                                                              • valuesArray of values to search for
                                                                                                                                                                              • rootNodeThe root node to start searching from
                                                                                                                                                                                Type
                                                                                                                                                                                (
                                                                                                                                                                                rootNode?: T,
                                                                                                                                                                                ) => Array<
                                                                                                                                                                                T & {
                                                                                                                                                                                _children: number[]
                                                                                                                                                                                _index: number
                                                                                                                                                                                _parent: number
                                                                                                                                                                                }
                                                                                                                                                                                >
                                                                                                                                                                                Description
                                                                                                                                                                                Flattens the tree into an array with parent/child relationships.
                                                                                                                                                                                • rootNodeThe root node to start flattening from
                                                                                                                                                                                  Type
                                                                                                                                                                                  (
                                                                                                                                                                                  rootNode?: T,
                                                                                                                                                                                  opts?: {
                                                                                                                                                                                  skip?: (args: {
                                                                                                                                                                                  indexPath: number[]
                                                                                                                                                                                  node: T
                                                                                                                                                                                  value: string
                                                                                                                                                                                  }) => boolean | void
                                                                                                                                                                                  } & {
                                                                                                                                                                                  depth?:
                                                                                                                                                                                  | number
                                                                                                                                                                                  | ((
                                                                                                                                                                                  nodeDepth: number,
                                                                                                                                                                                  ) => boolean)
                                                                                                                                                                                  },
                                                                                                                                                                                  ) => string[]
                                                                                                                                                                                  Description
                                                                                                                                                                                  Gets all branch node values with optional depth filtering.
                                                                                                                                                                                  • rootNodeThe root node to start from
                                                                                                                                                                                  • optsOptions for skipping nodes and filtering by depth
                                                                                                                                                                                    Type
                                                                                                                                                                                    (
                                                                                                                                                                                    value: string,
                                                                                                                                                                                    ) => number
                                                                                                                                                                                    Description
                                                                                                                                                                                    Gets the depth of a node with the specified value.
                                                                                                                                                                                    • valueThe value to find the depth for
                                                                                                                                                                                      Type
                                                                                                                                                                                      (
                                                                                                                                                                                      valueOrIndexPath?:
                                                                                                                                                                                      | string
                                                                                                                                                                                      | number[],
                                                                                                                                                                                      options?: T & {
                                                                                                                                                                                      disabled?: boolean
                                                                                                                                                                                      id?: string
                                                                                                                                                                                      onUnregister?: (
                                                                                                                                                                                      index: number,
                                                                                                                                                                                      ) => void
                                                                                                                                                                                      requireContext?: boolean
                                                                                                                                                                                      },
                                                                                                                                                                                      ) => Array<T>
                                                                                                                                                                                      Description
                                                                                                                                                                                      Gets all descendant nodes of the specified node.
                                                                                                                                                                                      • valueOrIndexPathEither a node value or index path
                                                                                                                                                                                      • optionsOptions for controlling which descendants to include
                                                                                                                                                                                        Type
                                                                                                                                                                                        (
                                                                                                                                                                                        valueOrIndexPath:
                                                                                                                                                                                        | string
                                                                                                                                                                                        | number[],
                                                                                                                                                                                        options?: T & {
                                                                                                                                                                                        disabled?: boolean
                                                                                                                                                                                        id?: string
                                                                                                                                                                                        onUnregister?: (
                                                                                                                                                                                        index: number,
                                                                                                                                                                                        ) => void
                                                                                                                                                                                        requireContext?: boolean
                                                                                                                                                                                        },
                                                                                                                                                                                        ) => string[]
                                                                                                                                                                                        Description
                                                                                                                                                                                        Gets all descendant values of the specified node.
                                                                                                                                                                                        • valueOrIndexPathEither a node value or index path
                                                                                                                                                                                        • optionsOptions for controlling which descendants to include
                                                                                                                                                                                          Type
                                                                                                                                                                                          (
                                                                                                                                                                                          rootNode?: T,
                                                                                                                                                                                          ) => T
                                                                                                                                                                                          Description
                                                                                                                                                                                          Gets the first non-disabled node in the tree.
                                                                                                                                                                                          • rootNodeThe root node to start searching from
                                                                                                                                                                                            Type
                                                                                                                                                                                            (
                                                                                                                                                                                            value: string,
                                                                                                                                                                                            ) => number[]
                                                                                                                                                                                            Description
                                                                                                                                                                                            Gets the index path for a node with the specified value.
                                                                                                                                                                                            • valueThe value to find the index path for
                                                                                                                                                                                              Type
                                                                                                                                                                                              (
                                                                                                                                                                                              rootNode?: T,
                                                                                                                                                                                              opts?: {
                                                                                                                                                                                              skip?: (args: {
                                                                                                                                                                                              indexPath: number[]
                                                                                                                                                                                              node: T
                                                                                                                                                                                              value: string
                                                                                                                                                                                              }) => boolean | void
                                                                                                                                                                                              },
                                                                                                                                                                                              ) => T
                                                                                                                                                                                              Description
                                                                                                                                                                                              Gets the last non-disabled node in the tree.
                                                                                                                                                                                              • rootNodeThe root node to start searching from
                                                                                                                                                                                              • optsOptions for skipping nodes during traversal
                                                                                                                                                                                                Type
                                                                                                                                                                                                (
                                                                                                                                                                                                value: string,
                                                                                                                                                                                                opts?: {
                                                                                                                                                                                                skip?: (args: {
                                                                                                                                                                                                indexPath: number[]
                                                                                                                                                                                                node: T
                                                                                                                                                                                                value: string
                                                                                                                                                                                                }) => boolean | void
                                                                                                                                                                                                },
                                                                                                                                                                                                ) => T
                                                                                                                                                                                                Description
                                                                                                                                                                                                Gets the next node after the one with the specified value.
                                                                                                                                                                                                • valueThe value to find the next node from
                                                                                                                                                                                                • optsOptions for skipping nodes during traversal
                                                                                                                                                                                                  Type
                                                                                                                                                                                                  (
                                                                                                                                                                                                  indexPath: number[],
                                                                                                                                                                                                  ) => T
                                                                                                                                                                                                  Description
                                                                                                                                                                                                  Gets the next non-disabled sibling of the node at the index path.
                                                                                                                                                                                                  • indexPathArray of indices representing the path to the node
                                                                                                                                                                                                    Type
                                                                                                                                                                                                    (
                                                                                                                                                                                                    node: T,
                                                                                                                                                                                                    ) => Array<T>
                                                                                                                                                                                                    Description
                                                                                                                                                                                                    Returns all child nodes for this node. Uses options.nodeToChildren if provided, otherwise falls back to default behavior.
                                                                                                                                                                                                        Type
                                                                                                                                                                                                        (
                                                                                                                                                                                                        node: T,
                                                                                                                                                                                                        ) => number
                                                                                                                                                                                                        Description
                                                                                                                                                                                                        Gets the number of children for a node, supporting lazy loading scenarios. Uses options.nodeToChildrenCount if provided, otherwise falls back to default behavior.
                                                                                                                                                                                                        • nodeThe node to get children count for
                                                                                                                                                                                                          Type
                                                                                                                                                                                                          (
                                                                                                                                                                                                          node: T,
                                                                                                                                                                                                          ) => boolean
                                                                                                                                                                                                          Description
                                                                                                                                                                                                          Checks if a node is disabled. Uses options.isNodeDisabled if provided, otherwise falls back to default behavior.
                                                                                                                                                                                                          • nodeThe node to check
                                                                                                                                                                                                            Type
                                                                                                                                                                                                            (
                                                                                                                                                                                                            node: T,
                                                                                                                                                                                                            ) => string
                                                                                                                                                                                                            Description
                                                                                                                                                                                                            Gets the string value for a node. Uses options.nodeValue if provided, otherwise falls back to default behavior.
                                                                                                                                                                                                            • nodeThe node to get the value from
                                                                                                                                                                                                              Type
                                                                                                                                                                                                              (
                                                                                                                                                                                                              valueOrIndexPath:
                                                                                                                                                                                                              | string
                                                                                                                                                                                                              | number[],
                                                                                                                                                                                                              ) => T
                                                                                                                                                                                                              Description
                                                                                                                                                                                                              Gets the parent node of the specified node.
                                                                                                                                                                                                              • valueOrIndexPathEither a node value or index path
                                                                                                                                                                                                                Type
                                                                                                                                                                                                                (
                                                                                                                                                                                                                valueOrIndexPath:
                                                                                                                                                                                                                | string
                                                                                                                                                                                                                | number[],
                                                                                                                                                                                                                ) => Array<T>
                                                                                                                                                                                                                Description
                                                                                                                                                                                                                Gets all parent nodes from root to the specified node.
                                                                                                                                                                                                                • valueOrIndexPathEither a node value or index path
                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                  (
                                                                                                                                                                                                                  value: string,
                                                                                                                                                                                                                  opts?: {
                                                                                                                                                                                                                  skip?: (args: {
                                                                                                                                                                                                                  indexPath: number[]
                                                                                                                                                                                                                  node: T
                                                                                                                                                                                                                  value: string
                                                                                                                                                                                                                  }) => boolean | void
                                                                                                                                                                                                                  },
                                                                                                                                                                                                                  ) => T
                                                                                                                                                                                                                  Description
                                                                                                                                                                                                                  Gets the previous node before the one with the specified value.
                                                                                                                                                                                                                  • valueThe value to find the previous node from
                                                                                                                                                                                                                  • optsOptions for skipping nodes during traversal
                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                    (
                                                                                                                                                                                                                    indexPath: number[],
                                                                                                                                                                                                                    ) => T
                                                                                                                                                                                                                    Description
                                                                                                                                                                                                                    Gets the previous non-disabled sibling of the node at the index path.
                                                                                                                                                                                                                    • indexPathArray of indices representing the path to the node
                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                      (
                                                                                                                                                                                                                      indexPath: number[],
                                                                                                                                                                                                                      ) => Array<T>
                                                                                                                                                                                                                      Description
                                                                                                                                                                                                                      Gets all sibling nodes of the node at the index path.
                                                                                                                                                                                                                      • indexPathArray of indices representing the path to the node
                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                        (
                                                                                                                                                                                                                        indexPath: number[],
                                                                                                                                                                                                                        ) => string
                                                                                                                                                                                                                        Description
                                                                                                                                                                                                                        Gets the value of the node at the specified index path.
                                                                                                                                                                                                                        • indexPathArray of indices representing the path to the node
                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                          (
                                                                                                                                                                                                                          indexPath: number[],
                                                                                                                                                                                                                          ) => string[]
                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                          Gets the path of values from root to the specified index path.
                                                                                                                                                                                                                          • indexPathArray of indices representing the path to the node
                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                            (
                                                                                                                                                                                                                            rootNode?: T,
                                                                                                                                                                                                                            ) => string[]
                                                                                                                                                                                                                            Description
                                                                                                                                                                                                                            Gets all values in the tree, excluding the root node.
                                                                                                                                                                                                                            • rootNodeThe root node to start from
                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                              (
                                                                                                                                                                                                                              parentIndexPath: IndexPath,
                                                                                                                                                                                                                              groupBy: (
                                                                                                                                                                                                                              node: T,
                                                                                                                                                                                                                              index: number,
                                                                                                                                                                                                                              ) => string,
                                                                                                                                                                                                                              sortGroups?:
                                                                                                                                                                                                                              | string[]
                                                                                                                                                                                                                              | ((
                                                                                                                                                                                                                              a: {
                                                                                                                                                                                                                              items: Array<{
                                                                                                                                                                                                                              indexPath: IndexPath
                                                                                                                                                                                                                              node: T
                                                                                                                                                                                                                              }>
                                                                                                                                                                                                                              key: string
                                                                                                                                                                                                                              },
                                                                                                                                                                                                                              b: {
                                                                                                                                                                                                                              items: Array<{
                                                                                                                                                                                                                              indexPath: IndexPath
                                                                                                                                                                                                                              node: T
                                                                                                                                                                                                                              }>
                                                                                                                                                                                                                              key: string
                                                                                                                                                                                                                              },
                                                                                                                                                                                                                              ) => number),
                                                                                                                                                                                                                              ) => GroupedTreeNode<T>[]
                                                                                                                                                                                                                              Description
                                                                                                                                                                                                                              Groups children of a parent node by a specified key.
                                                                                                                                                                                                                              • parentIndexPathIndex path of the parent node whose children to group. Pass [] for root-level children.
                                                                                                                                                                                                                              • groupByFunction that determines the group key for each child node
                                                                                                                                                                                                                              • sortGroupsOptional array of group keys defining order, or comparator function to sort the groups. By default, groups are sorted by first occurrence in the tree (insertion order)
                                                                                                                                                                                                                                // Group root-level children
                                                                                                                                                                                                                                const groups = collection.groupChildren([], (node) => node.group ?? 'default')

                                                                                                                                                                                                                                // Group with explicit order
                                                                                                                                                                                                                                const groups = collection.groupChildren(
                                                                                                                                                                                                                                [],
                                                                                                                                                                                                                                (node) => node.group,
                                                                                                                                                                                                                                ['primary', 'secondary', 'tertiary']
                                                                                                                                                                                                                                )

                                                                                                                                                                                                                                // Group with custom sorter
                                                                                                                                                                                                                                const groups = collection.groupChildren(
                                                                                                                                                                                                                                [],
                                                                                                                                                                                                                                (node) => node.group,
                                                                                                                                                                                                                                (a, b) => String(a.key).localeCompare(String(b.key))
                                                                                                                                                                                                                                )
                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                indexPath: number[],
                                                                                                                                                                                                                                nodes: Array<T>,
                                                                                                                                                                                                                                ) => any
                                                                                                                                                                                                                                Description
                                                                                                                                                                                                                                Inserts nodes after the node at the specified index path.
                                                                                                                                                                                                                                • indexPathArray of indices representing the insertion point
                                                                                                                                                                                                                                • nodesArray of nodes to insert
                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                  (
                                                                                                                                                                                                                                  indexPath: number[],
                                                                                                                                                                                                                                  nodes: Array<T>,
                                                                                                                                                                                                                                  ) => any
                                                                                                                                                                                                                                  Description
                                                                                                                                                                                                                                  Inserts nodes before the node at the specified index path.
                                                                                                                                                                                                                                  • indexPathArray of indices representing the insertion point
                                                                                                                                                                                                                                  • nodesArray of nodes to insert
                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                    node: T,
                                                                                                                                                                                                                                    ) => boolean
                                                                                                                                                                                                                                    Description
                                                                                                                                                                                                                                    Checks if a node is a branch node (has children or can have children).
                                                                                                                                                                                                                                    • nodeThe node to check
                                                                                                                                                                                                                                      Type
                                                                                                                                                                                                                                      (
                                                                                                                                                                                                                                      other: TreeCollection<T>,
                                                                                                                                                                                                                                      ) => boolean
                                                                                                                                                                                                                                      Description
                                                                                                                                                                                                                                      Compares this tree collection with another for deep equality.
                                                                                                                                                                                                                                      • otherThe other tree collection to compare with
                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                        (
                                                                                                                                                                                                                                        node: T,
                                                                                                                                                                                                                                        ) => boolean
                                                                                                                                                                                                                                        Description
                                                                                                                                                                                                                                        Checks if a node is the root node.
                                                                                                                                                                                                                                        • nodeThe node to check
                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                          (
                                                                                                                                                                                                                                          node: T,
                                                                                                                                                                                                                                          other: T,
                                                                                                                                                                                                                                          ) => boolean
                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                          Checks if two nodes are the same by comparing their values.
                                                                                                                                                                                                                                          • nodeFirst node to compare
                                                                                                                                                                                                                                          • otherSecond node to compare
                                                                                                                                                                                                                                            Type
                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                            fromIndexPaths: Array<
                                                                                                                                                                                                                                            number[]
                                                                                                                                                                                                                                            >,
                                                                                                                                                                                                                                            toIndexPath: number[],
                                                                                                                                                                                                                                            ) => any
                                                                                                                                                                                                                                            Description
                                                                                                                                                                                                                                            Moves nodes from one location to another in the tree.
                                                                                                                                                                                                                                            • fromIndexPathsArray of index paths to move from
                                                                                                                                                                                                                                            • toIndexPathIndex path to move to
                                                                                                                                                                                                                                              Type
                                                                                                                                                                                                                                              (
                                                                                                                                                                                                                                              indexPaths: Array<number[]>,
                                                                                                                                                                                                                                              ) => any
                                                                                                                                                                                                                                              Description
                                                                                                                                                                                                                                              Removes nodes at the specified index paths.
                                                                                                                                                                                                                                              • indexPathsArray of index paths to remove
                                                                                                                                                                                                                                                Type
                                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                                indexPath: number[],
                                                                                                                                                                                                                                                node: T,
                                                                                                                                                                                                                                                ) => any
                                                                                                                                                                                                                                                Description
                                                                                                                                                                                                                                                Replaces the node at the specified index path.
                                                                                                                                                                                                                                                • indexPathArray of indices representing the path to the node
                                                                                                                                                                                                                                                • nodeThe new node to replace with
                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                  T
                                                                                                                                                                                                                                                  Description
                                                                                                                                                                                                                                                  The root tree node.
                                                                                                                                                                                                                                                  Type
                                                                                                                                                                                                                                                  (
                                                                                                                                                                                                                                                  values: string[],
                                                                                                                                                                                                                                                  ) => string[]
                                                                                                                                                                                                                                                  Description
                                                                                                                                                                                                                                                  Sorts values according to their tree order.
                                                                                                                                                                                                                                                  • valuesArray of values to sort
                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                    value: string,
                                                                                                                                                                                                                                                    ) => string
                                                                                                                                                                                                                                                    Description
                                                                                                                                                                                                                                                    Converts a node value to its string representation.
                                                                                                                                                                                                                                                    • valueThe value to stringify
                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                    T,
                                                                                                                                                                                                                                                    ) => string
                                                                                                                                                                                                                                                    Description
                                                                                                                                                                                                                                                    Converts a node to its string representation. Uses options.nodeLabel if provided, otherwise falls back to default behavior: uses node.text, or node.value if node.text is not available.
                                                                                                                                                                                                                                                    • nodeThe node to stringify
                                                                                                                                                                                                                                                    Type
                                                                                                                                                                                                                                                    () => string[]
                                                                                                                                                                                                                                                    Description
                                                                                                                                                                                                                                                    Serializes the tree to a JSON-compatible array of values.
                                                                                                                                                                                                                                                        Type
                                                                                                                                                                                                                                                        (opts: {
                                                                                                                                                                                                                                                        onEnter?: (
                                                                                                                                                                                                                                                        node: T,
                                                                                                                                                                                                                                                        indexPath: number[],
                                                                                                                                                                                                                                                        ) => void | 'skip' | 'stop'
                                                                                                                                                                                                                                                        onLeave?: (
                                                                                                                                                                                                                                                        node: T,
                                                                                                                                                                                                                                                        indexPath: number[],
                                                                                                                                                                                                                                                        ) => void | 'stop'
                                                                                                                                                                                                                                                        reuseIndexPath?: boolean
                                                                                                                                                                                                                                                        skip?: (args: {
                                                                                                                                                                                                                                                        indexPath: number[]
                                                                                                                                                                                                                                                        node: T
                                                                                                                                                                                                                                                        value: string
                                                                                                                                                                                                                                                        }) => boolean | void
                                                                                                                                                                                                                                                        }) => void
                                                                                                                                                                                                                                                        Description
                                                                                                                                                                                                                                                        Visits all nodes in the tree with optional skip functionality.
                                                                                                                                                                                                                                                        • optsOptions for visiting nodes, including skip predicate

                                                                                                                                                                                                                                                          Element API

                                                                                                                                                                                                                                                          <SideNav.Group>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.GroupLabel>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.Divider>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.Header>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.HeaderTitle>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.HeaderAction>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.Branch>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.BranchNode>

                                                                                                                                                                                                                                                          An interactive tree node with children. Renders a <div> element by default.
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.BranchTrigger>

                                                                                                                                                                                                                                                          Icon that indicates whether a branch is expanded or collapsed. Renders a <div> element by default.
                                                                                                                                                                                                                                                          PropTypeDefault
                                                                                                                                                                                                                                                          The icon to display. This rotates by 180deg when the branch is expanded.
                                                                                                                                                                                                                                                          | LucideIcon
                                                                                                                                                                                                                                                          | ReactNode
                                                                                                                                                                                                                                                          ChevronDown
                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | LucideIcon
                                                                                                                                                                                                                                                          | ReactNode
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          The icon to display. This rotates by 180deg when the branch is expanded.
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.BranchContent>

                                                                                                                                                                                                                                                          Container element for the branch node's children. Renders a <div> element by default.
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          React children prop.
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          React children prop.
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.BranchIndentGuide>

                                                                                                                                                                                                                                                          Provides a visual guide to the indentation level of the branch's children. Renders a <div> element by default.
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.LeafNode>

                                                                                                                                                                                                                                                          A childless tree node. Renders a <div> element by default.
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.NodeAction>

                                                                                                                                                                                                                                                          An action button within a tree node's interactive area. Renders a <button> element by default.
                                                                                                                                                                                                                                                          PropTypeDefault
                                                                                                                                                                                                                                                          Lucide icon to display inside the button.
                                                                                                                                                                                                                                                          | LucideIcon
                                                                                                                                                                                                                                                          | ReactNode
                                                                                                                                                                                                                                                          The style variant of the button. Governs color. TODO: link to design system docs.
                                                                                                                                                                                                                                                          | 'neutral'
                                                                                                                                                                                                                                                          | 'persistent-white'
                                                                                                                                                                                                                                                          | 'persistent-black'
                                                                                                                                                                                                                                                          'neutral'
                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          The size of the button and its icon.
                                                                                                                                                                                                                                                          | 'sm'
                                                                                                                                                                                                                                                          | 'md'
                                                                                                                                                                                                                                                          | 'lg'
                                                                                                                                                                                                                                                          'md'
                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | LucideIcon
                                                                                                                                                                                                                                                          | ReactNode
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Lucide icon to display inside the button.
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | 'neutral'
                                                                                                                                                                                                                                                          | 'persistent-white'
                                                                                                                                                                                                                                                          | 'persistent-black'
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          The style variant of the button. Governs color. TODO: link to design system docs.
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | 'sm'
                                                                                                                                                                                                                                                          | 'md'
                                                                                                                                                                                                                                                          | 'lg'
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          The size of the button and its icon.

                                                                                                                                                                                                                                                          <SideNav.NodeIndicator>

                                                                                                                                                                                                                                                          Indicates whether the tree node is selected. Renders a <div> element by default.
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.NodeIcon>

                                                                                                                                                                                                                                                          The icon for the tree node. Renders a <span> element by default.
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          lucide-react icon or JSX Element.
                                                                                                                                                                                                                                                          | LucideIcon
                                                                                                                                                                                                                                                          | ReactNode
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | LucideIcon
                                                                                                                                                                                                                                                          | ReactNode
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          lucide-react icon or JSX Element.
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                                                                                                                                                                                                          <SideNav.NodeProvider>

                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          The index path of the tree node
                                                                                                                                                                                                                                                          number[]
                                                                                                                                                                                                                                                          The tree node
                                                                                                                                                                                                                                                          T
                                                                                                                                                                                                                                                          React children prop.
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          number[]
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          The index path of the tree node
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          T
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          The tree node
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          React children prop.

                                                                                                                                                                                                                                                          <SideNav.NodeText>

                                                                                                                                                                                                                                                          The primary title of the tree node. Renders a <span> element by default.
                                                                                                                                                                                                                                                          PropType
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Type
                                                                                                                                                                                                                                                          | ReactElement
                                                                                                                                                                                                                                                          | ((
                                                                                                                                                                                                                                                          props: object,
                                                                                                                                                                                                                                                          ) => ReactElement)
                                                                                                                                                                                                                                                          Description
                                                                                                                                                                                                                                                          Allows you to replace the component's HTML element with a different tag or component. Learn more