Side Nav

The side navigation provides a consistent, easy-to-scan way for users to move through major sections of an application. It stays visible as users browse, giving them a clear understanding of where they are and what options are available.

import {SideNavModule} from "@qualcomm-ui/angular/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 data. 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 <q-side-nav-nodes> shorthand for rendering nested nodes. Use the following directives to customize the tree nodes:

<ng-template
  let-branch
  q-side-nav-branch-template
  [rootNode]="collection.rootNode"
>
  <div q-side-nav-branch-node>
    <!-- ... -->
  </div>
</ng-template>

Note that <q-side-nav-nodes> automatically renders child nodes for branches, so you only have to customize the content of the node itself.

Qualcomm
Notifications
Dashboard
AI Studio
<div q-side-nav-root [collection]="collection">
  <div q-side-nav-header>
    <div q-side-nav-header-logo>
      <q-logo />
    </div>
    <div q-side-nav-header-title>Qualcomm</div>
  </div>

  @for (
    node of collection.rootNode.nodes;
    let i = $index;
    track collection.getNodeValue(node)
  ) {
    <q-side-nav-nodes [indexPath]="[i]" [node]="node">
      <ng-template
        let-branch
        q-side-nav-branch-template
        [rootNode]="collection.rootNode"
      >
        <div q-side-nav-branch-node>
          @if (branch.node.icon) {
            <svg q-side-nav-node-icon [qIcon]="branch.node.icon"></svg>
          }
          <span q-side-nav-node-text>{{ branch.node.text }}</span>
          <div q-side-nav-branch-trigger></div>
        </div>
      </ng-template>

      <ng-template
        let-leaf
        q-side-nav-leaf-template
        [rootNode]="collection.rootNode"
      >
        <div q-side-nav-leaf-node>
          <div q-side-nav-node-indicator></div>
          @if (leaf.node.icon) {
            <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
          }
          <span q-side-nav-node-text>{{ leaf.node.text }}</span>
        </div>
      </ng-template>
    </q-side-nav-nodes>
  }
</div>
Node Types

Pass the rootNode input to the template directives to enable TypeScript type inference. This allows branch.node and leaf.node to have your custom node type instead of the generic TreeNode type.

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
<div q-side-nav-root [collection]="collection">
  <div q-side-nav-header>
    <div q-side-nav-header-logo>
      <q-logo />
    </div>
    <div q-side-nav-header-title>Qualcomm</div>
  </div>

  @for (group of groups; track group.key) {
    <div q-side-nav-group>
      <div q-side-nav-divider></div>

      @if (group.key !== "ungrouped") {
        <div q-side-nav-group-label>{{ group.key }}</div>
      }

      @for (
        item of group.items;
        track collection.getNodeValue(item.node)
      ) {
        <q-side-nav-nodes [indexPath]="item.indexPath" [node]="item.node">
          <ng-template
            let-branch
            q-side-nav-branch-template
            [rootNode]="collection.rootNode"
          >
            <div q-side-nav-branch-node>
              <div q-side-nav-node-indicator></div>
              @if (branch.node.icon) {
                <svg
                  q-side-nav-node-icon
                  [qIcon]="branch.node.icon"
                ></svg>
              }
              <span q-side-nav-node-text>{{ branch.node.text }}</span>
              <div q-side-nav-branch-trigger></div>
            </div>
          </ng-template>

          <ng-template
            let-leaf
            q-side-nav-leaf-template
            [rootNode]="collection.rootNode"
          >
            <div q-side-nav-leaf-node>
              <div q-side-nav-node-indicator></div>
              @if (leaf.node.icon) {
                <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
              }
              <span q-side-nav-node-text>{{ leaf.node.text }}</span>
            </div>
          </ng-template>
        </q-side-nav-nodes>
      }
    </div>
  }
</div>

Sizes

Use the size input to control item padding, height, spacing, font size, and icon size. The available sizes are sm and md (default).

Qualcomm
Notifications
Settings
Main menu
Dashboard
AI Studio
Data Analysis
Administration
Profile
Security
Billing
import {Component} from "@angular/core"

import {provideIcons} from "@qualcomm-ui/angular-core/lucide"
import {IconDirective} from "@qualcomm-ui/angular/icon"
import {SideNavModule} from "@qualcomm-ui/angular/side-nav"

import {groupedCollection, groupedIcons} from "./grouped-items"
import {QLogoComponent} from "./q-logo.component"

@Component({
  imports: [SideNavModule, IconDirective, QLogoComponent],
  providers: [provideIcons(groupedIcons)],
  selector: "side-nav-size-demo",
  template: `
    <div class="flex justify-center">
      <div q-side-nav-root size="sm" [collection]="collection">
        <div q-side-nav-header>
          <div q-side-nav-header-logo>
            <q-logo />
          </div>
          <div q-side-nav-header-title>Qualcomm</div>
        </div>

        @for (group of groups; track group.key) {
          <div q-side-nav-group>
            <div q-side-nav-divider></div>

            @if (group.key !== "ungrouped") {
              <div q-side-nav-group-label>{{ group.key }}</div>
            }

            @for (
              item of group.items;
              track collection.getNodeValue(item.node)
            ) {
              <q-side-nav-nodes [indexPath]="item.indexPath" [node]="item.node">
                <ng-template
                  let-branch
                  q-side-nav-branch-template
                  [rootNode]="collection.rootNode"
                >
                  <div q-side-nav-branch-node>
                    <div q-side-nav-node-indicator></div>
                    @if (branch.node.icon) {
                      <svg
                        q-side-nav-node-icon
                        [qIcon]="branch.node.icon"
                      ></svg>
                    }
                    <span q-side-nav-node-text>{{ branch.node.text }}</span>
                    <div q-side-nav-branch-trigger></div>
                  </div>
                </ng-template>

                <ng-template
                  let-leaf
                  q-side-nav-leaf-template
                  [rootNode]="collection.rootNode"
                >
                  <div q-side-nav-leaf-node>
                    <div q-side-nav-node-indicator></div>
                    @if (leaf.node.icon) {
                      <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
                    }
                    <span q-side-nav-node-text>{{ leaf.node.text }}</span>
                  </div>
                </ng-template>
              </q-side-nav-nodes>
            }
          </div>
        }
      </div>
    </div>
  `,
})
export class SideNavSizeDemo {
  collection = groupedCollection

  groups = this.collection.groupChildren(
    [],
    (node) => node.group ?? "ungrouped",
    ["ungrouped", "Main menu"],
  )
}

Default Expanded

Expand nodes by default using the defaultExpandedValue input. Or use expandedValue and expandedValueChanged to control the expansion manually. These inputs follow our controlled state pattern.

Qualcomm
Notifications
Dashboard
AI Studio
Account
Profile
Security
Billing
<div
  q-side-nav-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
import {Component} from "@angular/core"
import {
  LucideBell,
  LucideCircleUser,
  LucideCreditCard,
  LucideLayoutDashboard,
  LucideNetwork,
  LucideShieldCheck,
  LucideUser,
} from "@lucide/angular"

import {provideIcons} from "@qualcomm-ui/angular-core/lucide"
import {IconDirective} from "@qualcomm-ui/angular/icon"
import {SideNavModule} from "@qualcomm-ui/angular/side-nav"
import {createTreeCollection} from "@qualcomm-ui/core/tree"

import {QLogoComponent} from "./q-logo.component"

interface SideNavItem {
  disabled?: boolean
  icon?: string
  id: string
  nodes?: SideNavItem[]
  text: string
}

const collection = createTreeCollection<SideNavItem>({
  nodeChildren: "nodes",
  nodeText: (node) => node.text,
  nodeValue: (node) => node.id,
  rootNode: {
    id: "ROOT",
    nodes: [
      {
        icon: "Bell",
        id: "notifications",
        text: "Notifications",
      },
      {
        disabled: true,
        icon: "LayoutDashboard",
        id: "dashboard",
        text: "Dashboard",
      },
      {
        icon: "Network",
        id: "ai-studio",
        text: "AI Studio",
      },
      {
        icon: "CircleUser",
        id: "account",
        nodes: [
          {
            icon: "User",
            id: "profile",
            text: "Profile",
          },
          {
            icon: "ShieldCheck",
            id: "security",
            text: "Security",
          },
          {
            icon: "CreditCard",
            id: "billing",
            text: "Billing",
          },
        ],
        text: "Account",
      },
    ],
    text: "",
  },
})

@Component({
  imports: [SideNavModule, IconDirective, QLogoComponent],
  providers: [
    provideIcons({
      LucideBell,
      LucideCircleUser,
      LucideCreditCard,
      LucideLayoutDashboard,
      LucideNetwork,
      LucideShieldCheck,
      LucideUser,
    }),
  ],
  selector: "side-nav-disabled-node-demo",
  template: `
    <div class="flex justify-center">
      <div
        q-side-nav-root
        [collection]="collection"
        [defaultExpandedValue]="['account']"
      >
        <div q-side-nav-header>
          <div q-side-nav-header-logo>
            <q-logo />
          </div>
          <div q-side-nav-header-title>Qualcomm</div>
        </div>

        @for (
          node of collection.rootNode.nodes;
          let i = $index;
          track collection.getNodeValue(node)
        ) {
          <q-side-nav-nodes [indexPath]="[i]" [node]="node">
            <ng-template
              let-branch
              q-side-nav-branch-template
              [rootNode]="collection.rootNode"
            >
              <div q-side-nav-branch-node>
                @if (branch.node.icon) {
                  <svg q-side-nav-node-icon [qIcon]="branch.node.icon"></svg>
                }
                <span q-side-nav-node-text>{{ branch.node.text }}</span>
                <div q-side-nav-branch-trigger></div>
              </div>
            </ng-template>

            <ng-template
              let-leaf
              q-side-nav-leaf-template
              [rootNode]="collection.rootNode"
            >
              <div q-side-nav-leaf-node>
                <div q-side-nav-node-indicator></div>
                @if (leaf.node.icon) {
                  <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
                }
                <span q-side-nav-node-text>{{ leaf.node.text }}</span>
              </div>
            </ng-template>
          </q-side-nav-nodes>
        }
      </div>
    </div>
  `,
})
export class SideNavDisabledNodeDemo {
  collection = collection
}

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, openChanged and defaultOpen inputs. These inputs follow our controlled state pattern.

Notifications
Dashboard
AI Studio
<div
  q-side-nav-root
  [collection]="collection"
  [open]="open()"
  (openChanged)="open.set($event)"
>
  <div q-side-nav-header>
    <div q-side-nav-header-logo>
      <q-logo />
    </div>
    <div q-side-nav-header-title>Qualcomm</div>
    <button q-side-nav-collapse-trigger></button>
  </div>

  @for (
    node of collection.rootNode.nodes;
    let i = $index;
    track collection.getNodeValue(node)
  ) {
    <q-side-nav-nodes [indexPath]="[i]" [node]="node">
      <ng-template
        let-branch
        q-side-nav-branch-template
        [rootNode]="collection.rootNode"
      >
        <div q-side-nav-branch-node [attr.aria-label]="branch.node.text">
          <div q-side-nav-node-indicator></div>
          @if (branch.node.icon) {
            <svg q-side-nav-node-icon [qIcon]="branch.node.icon"></svg>
          }
          <span q-side-nav-node-text>{{ branch.node.text }}</span>
          <div q-side-nav-branch-trigger></div>
        </div>
      </ng-template>

      <ng-template
        let-leaf
        q-side-nav-leaf-template
        [rootNode]="collection.rootNode"
      >
        <div q-side-nav-leaf-node [attr.aria-label]="leaf.node.text">
          <div q-side-nav-node-indicator></div>
          @if (leaf.node.icon) {
            <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
          }
          <span q-side-nav-node-text>{{ leaf.node.text }}</span>
        </div>
      </ng-template>
    </q-side-nav-nodes>
  }
</div>

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
<div
  q-side-nav-root
  [collection]="collection()"
  [expandedValue]="expanded()"
  (expandedValueChanged)="expanded.set($event.expandedValue)"
>
  <div q-side-nav-header>
    <div q-side-nav-header-logo>
      <q-logo />
    </div>
    <div q-side-nav-header-title>Qualcomm</div>
  </div>

  <hr q-side-nav-divider />

  <q-text-input
    aria-label="Search filter"
    placeholder="Search"
    q-side-nav-filter-input
    size="sm"
    startIcon="Search"
    style="margin-bottom: 16px"
    [ngModel]="query()"
    (ngModelChange)="search($event)"
  />

  @for (group of groups(); track group.key) {
    <div q-side-nav-group>
      <hr q-side-nav-divider />

      @if (group.key !== "ungrouped") {
        <div q-side-nav-group-label>{{ group.key }}</div>
      }

      @for (
        item of group.items;
        track collection().getNodeValue(item.node)
      ) {
        <q-side-nav-nodes [indexPath]="item.indexPath" [node]="item.node">
          <ng-template
            let-branch
            q-side-nav-branch-template
            [rootNode]="collection().rootNode"
          >
            <div q-side-nav-branch-node>
              @if (branch.node.icon) {
                <svg
                  q-side-nav-node-icon
                  [qIcon]="branch.node.icon"
                ></svg>
              }
              <span q-side-nav-node-text>{{ branch.node.text }}</span>
              <div q-side-nav-branch-trigger></div>
            </div>
          </ng-template>

          <ng-template
            let-leaf
            q-side-nav-leaf-template
            [rootNode]="collection().rootNode"
          >
            <div q-side-nav-leaf-node>
              <div q-side-nav-node-indicator></div>
              @if (leaf.node.icon) {
                <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
              }
              <span q-side-nav-node-text>{{ leaf.node.text }}</span>
            </div>
          </ng-template>
        </q-side-nav-nodes>
      }
    </div>
  }
</div>

Side Nav nodes can be links. Apply the q-side-nav-leaf-node directive to an anchor element with routerLink to create navigable links.

Qualcomm
<a q-side-nav-leaf-node [routerLink]="leaf.node.pathname">
  <div q-side-nav-node-indicator></div>
  <span q-side-nav-node-text>{{ leaf.node.text }}</span>
</a>

Surface

Use the surface input to change the background color of the Side Nav.

Qualcomm
Notifications
Settings
Main menu
Dashboard
AI Studio
Data Analysis
Administration
Profile
Security
Billing
import {Component} from "@angular/core"

import {provideIcons} from "@qualcomm-ui/angular-core/lucide"
import {IconDirective} from "@qualcomm-ui/angular/icon"
import {SideNavModule} from "@qualcomm-ui/angular/side-nav"

import {groupedCollection, groupedIcons} from "./grouped-items"
import {QLogoComponent} from "./q-logo.component"

@Component({
  imports: [SideNavModule, IconDirective, QLogoComponent],
  providers: [provideIcons(groupedIcons)],
  selector: "side-nav-surface-demo",
  template: `
    <div class="flex justify-center">
      <div q-side-nav-root surface="secondary" [collection]="collection">
        <div q-side-nav-header>
          <div q-side-nav-header-logo>
            <q-logo />
          </div>
          <div q-side-nav-header-title>Qualcomm</div>
        </div>

        @for (group of groups; track group.key) {
          <div q-side-nav-group>
            <div q-side-nav-divider></div>

            @if (group.key !== "ungrouped") {
              <div q-side-nav-group-label>{{ group.key }}</div>
            }

            @for (
              item of group.items;
              track collection.getNodeValue(item.node)
            ) {
              <q-side-nav-nodes [indexPath]="item.indexPath" [node]="item.node">
                <ng-template
                  let-branch
                  q-side-nav-branch-template
                  [rootNode]="collection.rootNode"
                >
                  <div q-side-nav-branch-node>
                    <div q-side-nav-node-indicator></div>
                    @if (branch.node.icon) {
                      <svg
                        q-side-nav-node-icon
                        [qIcon]="branch.node.icon"
                      ></svg>
                    }
                    <span q-side-nav-node-text>{{ branch.node.text }}</span>
                    <div q-side-nav-branch-trigger></div>
                  </div>
                </ng-template>

                <ng-template
                  let-leaf
                  q-side-nav-leaf-template
                  [rootNode]="collection.rootNode"
                >
                  <div q-side-nav-leaf-node>
                    <div q-side-nav-node-indicator></div>
                    @if (leaf.node.icon) {
                      <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
                    }
                    <span q-side-nav-node-text>{{ leaf.node.text }}</span>
                  </div>
                </ng-template>
              </q-side-nav-nodes>
            }
          </div>
        }
      </div>
    </div>
  `,
})
export class SideNavSurfaceDemo {
  collection = groupedCollection

  groups = this.collection.groupChildren(
    [],
    (node) => node.group ?? "ungrouped",
    ["ungrouped", "Main menu"],
  )
}

Tooltips

Consider wrapping collapsed nodes with the Tooltip component to provide context about each item. This is also useful for describing disabled nodes.

Notifications
Dashboard
Profile
Security
Billing
<div q-tooltip>
  <span q-tooltip-trigger>
    <div q-side-nav-leaf-node>
      <div q-side-nav-node-indicator></div>
      @if (leaf.node.icon) {
        <svg q-side-nav-node-icon [qIcon]="leaf.node.icon"></svg>
      }
      <span q-side-nav-node-text>{{ leaf.node.text }}</span>
    </div>
  </span>
  {{ leaf.node.tooltip || leaf.node.text }}
</div>

API

q-side-nav-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 | null
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'
Whether the side navigation collapse behavior 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 | null
A root node to correctly resolve the Document in custom environments. i.e., Iframes, Electron.
() =>
| ShadowRoot
| Document
| Node
HTML id attribute. If omitted, a unique identifier will be 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>>
The controlled open state of the side navigation
boolean
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
| 'single'
| 'multiple'
'single'
Callback function that determines whether a node should be hidden.
(
state: NodeState<T>,
) => boolean | undefined
v2.13.0
Governs item padding, height, spacing, font size, and icon size.
'sm' | 'md'
'md'
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
Called when the tree is opened or closed
{
expandedNodes: Array<T>
expandedValue: string[]
focusedValue: string | null
}
Called when the focused node changes
{
focusedNode: T | null
focusedValue: string | null
}
Called when a node finishes loading children
{
collection: TreeCollection<T>
}
Called when loading children fails for one or more nodes
{
nodes: Array<{
error: Error
indexPath: number[]
node: T
valuePath: string[]
}>
}
Called when the side navigation opens or closes
boolean
Called when the selection changes
{
focusedValue: string | null
selectedNodes: Array<T>
selectedValue: string[]
}
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 | null
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 side navigation collapse behavior 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 | null
Description
The value of the focused node
Type
() =>
| ShadowRoot
| Document
| Node
Description
A root node to correctly resolve the Document in custom environments. i.e., Iframes, Electron.
Type
string
Description
HTML id attribute. If omitted, a unique identifier will be 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
boolean
Description
The controlled open state of the side navigation
Type
string[]
Description
The controlled selected node value
Type
| 'single'
| 'multiple'
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 | undefined
Description
Callback function that determines whether a node should be hidden.
v2.13.0
Type
'sm' | 'md'
Description
Governs item padding, height, spacing, font size, and icon size.
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.
Type
{
expandedNodes: Array<T>
expandedValue: string[]
focusedValue: string | null
}
Description
Called when the tree is opened or closed
Type
{
focusedNode: T | null
focusedValue: string | null
}
Description
Called when the focused node changes
Type
{
collection: TreeCollection<T>
}
Description
Called when a node finishes loading children
Type
{
nodes: Array<{
error: Error
indexPath: number[]
node: T
valuePath: string[]
}>
}
Description
Called when loading children fails for one or more nodes
Type
boolean
Description
Called when the side navigation opens or closes
Type
{
focusedValue: string | null
selectedNodes: Array<T>
selectedValue: string[]
}
Description
Called when the selection changes

q-side-nav-nodes

PropType
The index path of the tree node
number[]
The tree node
T
TemplateRef<
SideNavBranchTemplateDirective<T>
>
TemplateRef<
SideNavLeafTemplateDirective<T>
>
boolean
Type
number[]
Description
The index path of the tree node
Type
T
Description
The tree node
Type
TemplateRef<
SideNavBranchTemplateDirective<T>
>
Type
TemplateRef<
SideNavLeafTemplateDirective<T>
>
Type
boolean

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 | undefined
    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 | undefined
    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.
      • indexPath:Array of indices representing the path to the node
        (
        indexPath: number[],
        ) => T | undefined
        Checks if a parent index path contains a child index path.
        • parentIndexPath:The parent path
        • valueIndexPath:The child path to check
          (
          parentIndexPath: number[],
          valueIndexPath: number[],
          ) => boolean
          Creates a new tree collection with the same options but different root node.
          • rootNode:The new root node for the copied collection
            (
            rootNode: T,
            ) => TreeCollection<T>
            Filters the tree keeping only nodes that match the predicate.
            • predicate:Function to test each node
              (
              predicate: (
              node: T,
              indexPath: number[],
              ) => boolean,
              ) => TreeCollection<T>
              Finds the first node with the specified value.
              • value:The value to search for
              • rootNode:The root node to start searching from
                (
                value: string,
                rootNode?: T,
                ) => T | undefined
                (
                predicate: (
                node: T,
                indexPath: number[],
                ) => boolean | undefined,
                rootNode?: T,
                ) => T | undefined
                Finds all nodes with values matching the provided array.
                • values:Array of values to search for
                • rootNode:The root node to start searching from
                  (
                  values: string[],
                  rootNode?: T,
                  ) => Array<T>
                  Flattens the tree into an array with parent/child relationships.
                  • rootNode:The root node to start flattening from
                    (
                    rootNode?: T,
                    ) => Array<FlatTreeNode<T>>
                    Gets all branch node values with optional depth filtering.
                    • rootNode:The root node to start from
                    • opts:Options for skipping nodes and filtering by depth
                      (
                      rootNode?: T,
                      opts?: {
                      skip?: (args: {
                      indexPath: number[]
                      node: T
                      value: string
                      }) =>
                      | boolean
                      | void
                      | undefined
                      } & {
                      depth?:
                      | number
                      | ((
                      nodeDepth: number,
                      ) => boolean)
                      | undefined
                      },
                      ) => string[]
                      Gets the depth of a node with the specified value.
                      • value:The value to find the depth for
                        (
                        value: string,
                        ) => number
                        Gets all descendant nodes of the specified node.
                        • valueOrIndexPath:Either a node value or index path
                        • options:Options for controlling which descendants to include
                          (
                          valueOrIndexPath?:
                          | string
                          | number[],
                          options?: {
                          withBranch?: boolean
                          },
                          ) => Array<T>
                          Gets all descendant values of the specified node.
                          • valueOrIndexPath:Either a node value or index path
                          • options:Options for controlling which descendants to include
                            (
                            valueOrIndexPath:
                            | string
                            | number[],
                            options?: {
                            withBranch?: boolean
                            },
                            ) => string[]
                            Gets the first non-disabled node in the tree.
                            • rootNode:The root node to start searching from
                              (
                              rootNode?: T,
                              ) => T | undefined
                              Gets the index path for a node with the specified value.
                              • value:The value to find the index path for
                                (
                                value: string,
                                ) => number[] | undefined
                                Gets the last non-disabled node in the tree.
                                • rootNode:The root node to start searching from
                                • opts:Options for skipping nodes during traversal
                                  (
                                  rootNode?: T,
                                  opts?: {
                                  skip?: (args: {
                                  indexPath: number[]
                                  node: T
                                  value: string
                                  }) =>
                                  | boolean
                                  | void
                                  | undefined
                                  },
                                  ) => T | undefined
                                  Gets the next node after the one with the specified value.
                                  • value:The value to find the next node from
                                  • opts:Options for skipping nodes during traversal
                                    (
                                    value: string,
                                    opts?: {
                                    skip?: (args: {
                                    indexPath: number[]
                                    node: T
                                    value: string
                                    }) =>
                                    | boolean
                                    | void
                                    | undefined
                                    },
                                    ) => T | undefined
                                    Gets the next non-disabled sibling of the node at the index path.
                                    • indexPath:Array of indices representing the path to the node
                                      (
                                      indexPath: number[],
                                      ) => T | undefined
                                      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.
                                          • node:The node to get children count for
                                            (
                                            node: T,
                                            ) => number | undefined
                                            Checks if a node is disabled. Uses options.isNodeDisabled if provided, otherwise falls back to default behavior.
                                            • node:The node to check
                                              (
                                              node: T,
                                              ) => boolean
                                              Gets the string value for a node. Uses options.nodeValue if provided, otherwise falls back to default behavior.
                                              • node:The node to get the value from
                                                (
                                                node: T,
                                                ) => string
                                                Gets the parent node of the specified node.
                                                • valueOrIndexPath:Either a node value or index path
                                                  (
                                                  valueOrIndexPath:
                                                  | string
                                                  | number[],
                                                  ) => T | undefined
                                                  Gets all parent nodes from root to the specified node.
                                                  • valueOrIndexPath:Either a node value or index path
                                                    (
                                                    valueOrIndexPath:
                                                    | string
                                                    | number[],
                                                    ) => Array<T>
                                                    Gets the previous node before the one with the specified value.
                                                    • value:The value to find the previous node from
                                                    • opts:Options for skipping nodes during traversal
                                                      (
                                                      value: string,
                                                      opts?: {
                                                      skip?: (args: {
                                                      indexPath: number[]
                                                      node: T
                                                      value: string
                                                      }) =>
                                                      | boolean
                                                      | void
                                                      | undefined
                                                      },
                                                      ) => T | undefined
                                                      Gets the previous non-disabled sibling of the node at the index path.
                                                      • indexPath:Array of indices representing the path to the node
                                                        (
                                                        indexPath: number[],
                                                        ) => T | undefined
                                                        Gets all sibling nodes of the node at the index path.
                                                        • indexPath:Array of indices representing the path to the node
                                                          (
                                                          indexPath: number[],
                                                          ) => Array<T>
                                                          Gets the value of the node at the specified index path.
                                                          • indexPath:Array of indices representing the path to the node
                                                            (
                                                            indexPath: number[],
                                                            ) => string | undefined
                                                            Gets the path of values from root to the specified index path.
                                                            • indexPath:Array of indices representing the path to the node
                                                              (
                                                              indexPath:
                                                              | number[]
                                                              | undefined,
                                                              ) => string[]
                                                              Gets all values in the tree, excluding the root node.
                                                              • rootNode:The root node to start from
                                                                (
                                                                rootNode?: T,
                                                                ) => string[]
                                                                Groups children of a parent node by a specified key.
                                                                • parentIndexPath:Index path of the parent node whose children to group. Pass [] for root-level children.
                                                                • groupBy:Function that determines the group key for each child node
                                                                • sortGroups:Optional 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)
                                                                  Returns:
                                                                  Array of groups, each containing a key and array of items with node and indexPath
                                                                  (
                                                                  parentIndexPath: IndexPath,
                                                                  groupBy: (
                                                                  node: T,
                                                                  index: number,
                                                                  ) => string,
                                                                  sortGroups?:
                                                                  | string[]
                                                                  | ((
                                                                  a: {
                                                                  items: {
                                                                  indexPath: IndexPath
                                                                  node: T
                                                                  }[]
                                                                  key: string
                                                                  },
                                                                  b: {
                                                                  items: {
                                                                  indexPath: IndexPath
                                                                  node: T
                                                                  }[]
                                                                  key: string
                                                                  },
                                                                  ) => number),
                                                                  ) => GroupedTreeNode<T>[]
                                                                  Inserts nodes after the node at the specified index path.
                                                                  • indexPath:Array of indices representing the insertion point
                                                                  • nodes:Array of nodes to insert
                                                                    (
                                                                    indexPath: number[],
                                                                    nodes: Array<T>,
                                                                    ) =>
                                                                    | TreeCollection<T>
                                                                    | undefined
                                                                    Inserts nodes before the node at the specified index path.
                                                                    • indexPath:Array of indices representing the insertion point
                                                                    • nodes:Array of nodes to insert
                                                                      (
                                                                      indexPath: number[],
                                                                      nodes: Array<T>,
                                                                      ) =>
                                                                      | TreeCollection<T>
                                                                      | undefined
                                                                      Checks if a node is a branch node (has children or can have children).
                                                                      • node:The node to check
                                                                        (
                                                                        node: T,
                                                                        ) => boolean
                                                                        Compares this tree collection with another for deep equality.
                                                                        • other:The other tree collection to compare with
                                                                          (
                                                                          other: TreeCollection<T>,
                                                                          ) => boolean
                                                                          Checks if a node is the root node.
                                                                          • node:The node to check
                                                                            (
                                                                            node: T,
                                                                            ) => boolean
                                                                            Checks if two nodes are the same by comparing their values.
                                                                            • node:First node to compare
                                                                            • other:Second node to compare
                                                                              (
                                                                              node: T,
                                                                              other: T,
                                                                              ) => boolean
                                                                              Moves nodes from one location to another in the tree.
                                                                              • fromIndexPaths:Array of index paths to move from
                                                                              • toIndexPath:Index path to move to
                                                                                (
                                                                                fromIndexPaths: Array<
                                                                                number[]
                                                                                >,
                                                                                toIndexPath: number[],
                                                                                ) => TreeCollection<T>
                                                                                Removes nodes at the specified index paths.
                                                                                • indexPaths:Array of index paths to remove
                                                                                  (
                                                                                  indexPaths: Array<number[]>,
                                                                                  ) => TreeCollection<T>
                                                                                  Replaces the node at the specified index path.
                                                                                  • indexPath:Array of indices representing the path to the node
                                                                                  • node:The new node to replace with
                                                                                    (
                                                                                    indexPath: number[],
                                                                                    node: T,
                                                                                    ) => TreeCollection<T>
                                                                                    Replaces the children for the node at the specified index path.
                                                                                    • indexPath:Array of indices representing the path to the node
                                                                                    • children:Array of child nodes to set on the target node
                                                                                      (
                                                                                      indexPath: number[],
                                                                                      children: Array<T>,
                                                                                      ) => TreeCollection<T>
                                                                                      The root tree node.
                                                                                      T
                                                                                      Sorts values according to their tree order.
                                                                                      • values:Array of values to sort
                                                                                        (
                                                                                        values: string[],
                                                                                        ) => string[]
                                                                                        Converts a node value to its string representation.
                                                                                        (
                                                                                        value: string,
                                                                                        ) => string | null
                                                                                        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.
                                                                                        (
                                                                                        node: T,
                                                                                        ) => string
                                                                                        Serializes the tree to a JSON-compatible array of values.
                                                                                            () => string[]
                                                                                            Visits all nodes in the tree with optional skip functionality.
                                                                                            • opts:Options for visiting nodes, including skip predicate
                                                                                              (
                                                                                              opts: CollectionTreeVisitOpts<T>,
                                                                                              ) => void
                                                                                              Type
                                                                                              (
                                                                                              indexPath: number[],
                                                                                              ) => T | undefined
                                                                                              Description
                                                                                              Gets the node at the specified index path.
                                                                                              • indexPath:Array 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.
                                                                                                • parentIndexPath:The parent path
                                                                                                • valueIndexPath:The child path to check
                                                                                                  Type
                                                                                                  (
                                                                                                  rootNode: T,
                                                                                                  ) => TreeCollection<T>
                                                                                                  Description
                                                                                                  Creates a new tree collection with the same options but different root node.
                                                                                                  • rootNode:The new root node for the copied collection
                                                                                                    Type
                                                                                                    (
                                                                                                    predicate: (
                                                                                                    node: T,
                                                                                                    indexPath: number[],
                                                                                                    ) => boolean,
                                                                                                    ) => TreeCollection<T>
                                                                                                    Description
                                                                                                    Filters the tree keeping only nodes that match the predicate.
                                                                                                    • predicate:Function to test each node
                                                                                                      Type
                                                                                                      (
                                                                                                      value: string,
                                                                                                      rootNode?: T,
                                                                                                      ) => T | undefined
                                                                                                      Description
                                                                                                      Finds the first node with the specified value.
                                                                                                      • value:The value to search for
                                                                                                      • rootNode:The root node to start searching from
                                                                                                        Type
                                                                                                        (
                                                                                                        predicate: (
                                                                                                        node: T,
                                                                                                        indexPath: number[],
                                                                                                        ) => boolean | undefined,
                                                                                                        rootNode?: T,
                                                                                                        ) => T | undefined
                                                                                                        Type
                                                                                                        (
                                                                                                        values: string[],
                                                                                                        rootNode?: T,
                                                                                                        ) => Array<T>
                                                                                                        Description
                                                                                                        Finds all nodes with values matching the provided array.
                                                                                                        • values:Array of values to search for
                                                                                                        • rootNode:The root node to start searching from
                                                                                                          Type
                                                                                                          (
                                                                                                          rootNode?: T,
                                                                                                          ) => Array<FlatTreeNode<T>>
                                                                                                          Description
                                                                                                          Flattens the tree into an array with parent/child relationships.
                                                                                                          • rootNode:The root node to start flattening from
                                                                                                            Type
                                                                                                            (
                                                                                                            rootNode?: T,
                                                                                                            opts?: {
                                                                                                            skip?: (args: {
                                                                                                            indexPath: number[]
                                                                                                            node: T
                                                                                                            value: string
                                                                                                            }) =>
                                                                                                            | boolean
                                                                                                            | void
                                                                                                            | undefined
                                                                                                            } & {
                                                                                                            depth?:
                                                                                                            | number
                                                                                                            | ((
                                                                                                            nodeDepth: number,
                                                                                                            ) => boolean)
                                                                                                            | undefined
                                                                                                            },
                                                                                                            ) => string[]
                                                                                                            Description
                                                                                                            Gets all branch node values with optional depth filtering.
                                                                                                            • rootNode:The root node to start from
                                                                                                            • opts:Options for skipping nodes and filtering by depth
                                                                                                              Type
                                                                                                              (
                                                                                                              value: string,
                                                                                                              ) => number
                                                                                                              Description
                                                                                                              Gets the depth of a node with the specified value.
                                                                                                              • value:The value to find the depth for
                                                                                                                Type
                                                                                                                (
                                                                                                                valueOrIndexPath?:
                                                                                                                | string
                                                                                                                | number[],
                                                                                                                options?: {
                                                                                                                withBranch?: boolean
                                                                                                                },
                                                                                                                ) => Array<T>
                                                                                                                Description
                                                                                                                Gets all descendant nodes of the specified node.
                                                                                                                • valueOrIndexPath:Either a node value or index path
                                                                                                                • options:Options for controlling which descendants to include
                                                                                                                  Type
                                                                                                                  (
                                                                                                                  valueOrIndexPath:
                                                                                                                  | string
                                                                                                                  | number[],
                                                                                                                  options?: {
                                                                                                                  withBranch?: boolean
                                                                                                                  },
                                                                                                                  ) => string[]
                                                                                                                  Description
                                                                                                                  Gets all descendant values of the specified node.
                                                                                                                  • valueOrIndexPath:Either a node value or index path
                                                                                                                  • options:Options for controlling which descendants to include
                                                                                                                    Type
                                                                                                                    (
                                                                                                                    rootNode?: T,
                                                                                                                    ) => T | undefined
                                                                                                                    Description
                                                                                                                    Gets the first non-disabled node in the tree.
                                                                                                                    • rootNode:The root node to start searching from
                                                                                                                      Type
                                                                                                                      (
                                                                                                                      value: string,
                                                                                                                      ) => number[] | undefined
                                                                                                                      Description
                                                                                                                      Gets the index path for a node with the specified value.
                                                                                                                      • value:The value to find the index path for
                                                                                                                        Type
                                                                                                                        (
                                                                                                                        rootNode?: T,
                                                                                                                        opts?: {
                                                                                                                        skip?: (args: {
                                                                                                                        indexPath: number[]
                                                                                                                        node: T
                                                                                                                        value: string
                                                                                                                        }) =>
                                                                                                                        | boolean
                                                                                                                        | void
                                                                                                                        | undefined
                                                                                                                        },
                                                                                                                        ) => T | undefined
                                                                                                                        Description
                                                                                                                        Gets the last non-disabled node in the tree.
                                                                                                                        • rootNode:The root node to start searching from
                                                                                                                        • opts:Options for skipping nodes during traversal
                                                                                                                          Type
                                                                                                                          (
                                                                                                                          value: string,
                                                                                                                          opts?: {
                                                                                                                          skip?: (args: {
                                                                                                                          indexPath: number[]
                                                                                                                          node: T
                                                                                                                          value: string
                                                                                                                          }) =>
                                                                                                                          | boolean
                                                                                                                          | void
                                                                                                                          | undefined
                                                                                                                          },
                                                                                                                          ) => T | undefined
                                                                                                                          Description
                                                                                                                          Gets the next node after the one with the specified value.
                                                                                                                          • value:The value to find the next node from
                                                                                                                          • opts:Options for skipping nodes during traversal
                                                                                                                            Type
                                                                                                                            (
                                                                                                                            indexPath: number[],
                                                                                                                            ) => T | undefined
                                                                                                                            Description
                                                                                                                            Gets the next non-disabled sibling of the node at the index path.
                                                                                                                            • indexPath:Array 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 | undefined
                                                                                                                                  Description
                                                                                                                                  Gets the number of children for a node, supporting lazy loading scenarios. Uses options.nodeToChildrenCount if provided, otherwise falls back to default behavior.
                                                                                                                                  • node:The 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.
                                                                                                                                    • node:The 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.
                                                                                                                                      • node:The node to get the value from
                                                                                                                                        Type
                                                                                                                                        (
                                                                                                                                        valueOrIndexPath:
                                                                                                                                        | string
                                                                                                                                        | number[],
                                                                                                                                        ) => T | undefined
                                                                                                                                        Description
                                                                                                                                        Gets the parent node of the specified node.
                                                                                                                                        • valueOrIndexPath:Either a node value or index path
                                                                                                                                          Type
                                                                                                                                          (
                                                                                                                                          valueOrIndexPath:
                                                                                                                                          | string
                                                                                                                                          | number[],
                                                                                                                                          ) => Array<T>
                                                                                                                                          Description
                                                                                                                                          Gets all parent nodes from root to the specified node.
                                                                                                                                          • valueOrIndexPath:Either a node value or index path
                                                                                                                                            Type
                                                                                                                                            (
                                                                                                                                            value: string,
                                                                                                                                            opts?: {
                                                                                                                                            skip?: (args: {
                                                                                                                                            indexPath: number[]
                                                                                                                                            node: T
                                                                                                                                            value: string
                                                                                                                                            }) =>
                                                                                                                                            | boolean
                                                                                                                                            | void
                                                                                                                                            | undefined
                                                                                                                                            },
                                                                                                                                            ) => T | undefined
                                                                                                                                            Description
                                                                                                                                            Gets the previous node before the one with the specified value.
                                                                                                                                            • value:The value to find the previous node from
                                                                                                                                            • opts:Options for skipping nodes during traversal
                                                                                                                                              Type
                                                                                                                                              (
                                                                                                                                              indexPath: number[],
                                                                                                                                              ) => T | undefined
                                                                                                                                              Description
                                                                                                                                              Gets the previous non-disabled sibling of the node at the index path.
                                                                                                                                              • indexPath:Array 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.
                                                                                                                                                • indexPath:Array of indices representing the path to the node
                                                                                                                                                  Type
                                                                                                                                                  (
                                                                                                                                                  indexPath: number[],
                                                                                                                                                  ) => string | undefined
                                                                                                                                                  Description
                                                                                                                                                  Gets the value of the node at the specified index path.
                                                                                                                                                  • indexPath:Array of indices representing the path to the node
                                                                                                                                                    Type
                                                                                                                                                    (
                                                                                                                                                    indexPath:
                                                                                                                                                    | number[]
                                                                                                                                                    | undefined,
                                                                                                                                                    ) => string[]
                                                                                                                                                    Description
                                                                                                                                                    Gets the path of values from root to the specified index path.
                                                                                                                                                    • indexPath:Array of indices representing the path to the node
                                                                                                                                                      Type
                                                                                                                                                      (
                                                                                                                                                      rootNode?: T,
                                                                                                                                                      ) => string[]
                                                                                                                                                      Description
                                                                                                                                                      Gets all values in the tree, excluding the root node.
                                                                                                                                                      • rootNode:The root node to start from
                                                                                                                                                        Type
                                                                                                                                                        (
                                                                                                                                                        parentIndexPath: IndexPath,
                                                                                                                                                        groupBy: (
                                                                                                                                                        node: T,
                                                                                                                                                        index: number,
                                                                                                                                                        ) => string,
                                                                                                                                                        sortGroups?:
                                                                                                                                                        | string[]
                                                                                                                                                        | ((
                                                                                                                                                        a: {
                                                                                                                                                        items: {
                                                                                                                                                        indexPath: IndexPath
                                                                                                                                                        node: T
                                                                                                                                                        }[]
                                                                                                                                                        key: string
                                                                                                                                                        },
                                                                                                                                                        b: {
                                                                                                                                                        items: {
                                                                                                                                                        indexPath: IndexPath
                                                                                                                                                        node: T
                                                                                                                                                        }[]
                                                                                                                                                        key: string
                                                                                                                                                        },
                                                                                                                                                        ) => number),
                                                                                                                                                        ) => GroupedTreeNode<T>[]
                                                                                                                                                        Description
                                                                                                                                                        Groups children of a parent node by a specified key.
                                                                                                                                                        • parentIndexPath:Index path of the parent node whose children to group. Pass [] for root-level children.
                                                                                                                                                        • groupBy:Function that determines the group key for each child node
                                                                                                                                                        • sortGroups:Optional 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)
                                                                                                                                                          Returns:
                                                                                                                                                          Array of groups, each containing a key and array of items with node and indexPath
                                                                                                                                                          Type
                                                                                                                                                          (
                                                                                                                                                          indexPath: number[],
                                                                                                                                                          nodes: Array<T>,
                                                                                                                                                          ) =>
                                                                                                                                                          | TreeCollection<T>
                                                                                                                                                          | undefined
                                                                                                                                                          Description
                                                                                                                                                          Inserts nodes after the node at the specified index path.
                                                                                                                                                          • indexPath:Array of indices representing the insertion point
                                                                                                                                                          • nodes:Array of nodes to insert
                                                                                                                                                            Type
                                                                                                                                                            (
                                                                                                                                                            indexPath: number[],
                                                                                                                                                            nodes: Array<T>,
                                                                                                                                                            ) =>
                                                                                                                                                            | TreeCollection<T>
                                                                                                                                                            | undefined
                                                                                                                                                            Description
                                                                                                                                                            Inserts nodes before the node at the specified index path.
                                                                                                                                                            • indexPath:Array of indices representing the insertion point
                                                                                                                                                            • nodes:Array of nodes to insert
                                                                                                                                                              Type
                                                                                                                                                              (
                                                                                                                                                              node: T,
                                                                                                                                                              ) => boolean
                                                                                                                                                              Description
                                                                                                                                                              Checks if a node is a branch node (has children or can have children).
                                                                                                                                                              • node:The node to check
                                                                                                                                                                Type
                                                                                                                                                                (
                                                                                                                                                                other: TreeCollection<T>,
                                                                                                                                                                ) => boolean
                                                                                                                                                                Description
                                                                                                                                                                Compares this tree collection with another for deep equality.
                                                                                                                                                                • other:The other tree collection to compare with
                                                                                                                                                                  Type
                                                                                                                                                                  (
                                                                                                                                                                  node: T,
                                                                                                                                                                  ) => boolean
                                                                                                                                                                  Description
                                                                                                                                                                  Checks if a node is the root node.
                                                                                                                                                                  • node:The node to check
                                                                                                                                                                    Type
                                                                                                                                                                    (
                                                                                                                                                                    node: T,
                                                                                                                                                                    other: T,
                                                                                                                                                                    ) => boolean
                                                                                                                                                                    Description
                                                                                                                                                                    Checks if two nodes are the same by comparing their values.
                                                                                                                                                                    • node:First node to compare
                                                                                                                                                                    • other:Second node to compare
                                                                                                                                                                      Type
                                                                                                                                                                      (
                                                                                                                                                                      fromIndexPaths: Array<
                                                                                                                                                                      number[]
                                                                                                                                                                      >,
                                                                                                                                                                      toIndexPath: number[],
                                                                                                                                                                      ) => TreeCollection<T>
                                                                                                                                                                      Description
                                                                                                                                                                      Moves nodes from one location to another in the tree.
                                                                                                                                                                      • fromIndexPaths:Array of index paths to move from
                                                                                                                                                                      • toIndexPath:Index path to move to
                                                                                                                                                                        Type
                                                                                                                                                                        (
                                                                                                                                                                        indexPaths: Array<number[]>,
                                                                                                                                                                        ) => TreeCollection<T>
                                                                                                                                                                        Description
                                                                                                                                                                        Removes nodes at the specified index paths.
                                                                                                                                                                        • indexPaths:Array of index paths to remove
                                                                                                                                                                          Type
                                                                                                                                                                          (
                                                                                                                                                                          indexPath: number[],
                                                                                                                                                                          node: T,
                                                                                                                                                                          ) => TreeCollection<T>
                                                                                                                                                                          Description
                                                                                                                                                                          Replaces the node at the specified index path.
                                                                                                                                                                          • indexPath:Array of indices representing the path to the node
                                                                                                                                                                          • node:The new node to replace with
                                                                                                                                                                            Type
                                                                                                                                                                            (
                                                                                                                                                                            indexPath: number[],
                                                                                                                                                                            children: Array<T>,
                                                                                                                                                                            ) => TreeCollection<T>
                                                                                                                                                                            Description
                                                                                                                                                                            Replaces the children for the node at the specified index path.
                                                                                                                                                                            • indexPath:Array of indices representing the path to the node
                                                                                                                                                                            • children:Array of child nodes to set on the target node
                                                                                                                                                                              Type
                                                                                                                                                                              T
                                                                                                                                                                              Description
                                                                                                                                                                              The root tree node.
                                                                                                                                                                              Type
                                                                                                                                                                              (
                                                                                                                                                                              values: string[],
                                                                                                                                                                              ) => string[]
                                                                                                                                                                              Description
                                                                                                                                                                              Sorts values according to their tree order.
                                                                                                                                                                              • values:Array of values to sort
                                                                                                                                                                                Type
                                                                                                                                                                                (
                                                                                                                                                                                value: string,
                                                                                                                                                                                ) => string | null
                                                                                                                                                                                Description
                                                                                                                                                                                Converts a node value to its string representation.
                                                                                                                                                                                Type
                                                                                                                                                                                (
                                                                                                                                                                                node: 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.
                                                                                                                                                                                Type
                                                                                                                                                                                () => string[]
                                                                                                                                                                                Description
                                                                                                                                                                                Serializes the tree to a JSON-compatible array of values.
                                                                                                                                                                                    Type
                                                                                                                                                                                    (
                                                                                                                                                                                    opts: CollectionTreeVisitOpts<T>,
                                                                                                                                                                                    ) => void
                                                                                                                                                                                    Description
                                                                                                                                                                                    Visits all nodes in the tree with optional skip functionality.
                                                                                                                                                                                    • opts:Options for visiting nodes, including skip predicate

                                                                                                                                                                                      Element API

                                                                                                                                                                                      q-side-nav-header

                                                                                                                                                                                      q-side-nav-header-title

                                                                                                                                                                                      q-side-nav-header-action

                                                                                                                                                                                      q-side-nav-collapse-trigger

                                                                                                                                                                                      PropType
                                                                                                                                                                                      HTML id attribute. If omitted, a unique identifier will be generated for accessibility.
                                                                                                                                                                                      string
                                                                                                                                                                                      Type
                                                                                                                                                                                      string
                                                                                                                                                                                      Description
                                                                                                                                                                                      HTML id attribute. If omitted, a unique identifier will be generated for accessibility.

                                                                                                                                                                                      q-side-nav-group

                                                                                                                                                                                      q-side-nav-group-label

                                                                                                                                                                                      q-side-nav-divider

                                                                                                                                                                                      q-side-nav-branch

                                                                                                                                                                                      q-side-nav-branch-node

                                                                                                                                                                                      q-side-nav-branch-trigger

                                                                                                                                                                                      PropTypeDefault
                                                                                                                                                                                      The icon to display. This rotates by 180deg when the branch is expanded.
                                                                                                                                                                                      | LucideIcon
                                                                                                                                                                                      | LucideIconData
                                                                                                                                                                                      | string
                                                                                                                                                                                      LucideChevronDown
                                                                                                                                                                                      
                                                                                                                                                                                      Type
                                                                                                                                                                                      | LucideIcon
                                                                                                                                                                                      | LucideIconData
                                                                                                                                                                                      | string
                                                                                                                                                                                      Description
                                                                                                                                                                                      The icon to display. This rotates by 180deg when the branch is expanded.

                                                                                                                                                                                      q-side-nav-branch-content

                                                                                                                                                                                      PropType
                                                                                                                                                                                      string
                                                                                                                                                                                      Type
                                                                                                                                                                                      string

                                                                                                                                                                                      q-side-nav-branch-indent-guide

                                                                                                                                                                                      q-side-nav-leaf-node

                                                                                                                                                                                      q-side-nav-node-icon

                                                                                                                                                                                      q-side-nav-node-text

                                                                                                                                                                                      q-side-nav-node-indicator

                                                                                                                                                                                      q-side-nav-node-action

                                                                                                                                                                                      q-side-nav-node-accessory

                                                                                                                                                                                      q-side-nav-filter-input

                                                                                                                                                                                      Template Directives

                                                                                                                                                                                      q-side-nav-branch-template

                                                                                                                                                                                      Structural directive that defines the template used to render branch nodes in a side nav. Apply this to an ng-template to customize how branch nodes (nodes with children) are displayed. Note that this template will only customize the content of the node. The parent <q-side-nav-nodes> component renders the branch children internally.
                                                                                                                                                                                      PropType
                                                                                                                                                                                      The root node of the tree. Used for type narrowing of the template guard.
                                                                                                                                                                                      T
                                                                                                                                                                                      Type
                                                                                                                                                                                      T
                                                                                                                                                                                      Description
                                                                                                                                                                                      The root node of the tree. Used for type narrowing of the template guard.

                                                                                                                                                                                      q-side-nav-leaf-template

                                                                                                                                                                                      Structural directive that defines the template used to render leaf nodes in a side nav. Apply this to an ng-template to customize how leaf nodes (nodes without children) are displayed.
                                                                                                                                                                                      PropType
                                                                                                                                                                                      The root node of the tree. Used for type narrowing of the template guard.
                                                                                                                                                                                      T
                                                                                                                                                                                      Type
                                                                                                                                                                                      T
                                                                                                                                                                                      Description
                                                                                                                                                                                      The root node of the tree. Used for type narrowing of the template guard.

                                                                                                                                                                                      Use this directive on an ng-template to customize the rendering of leaf nodes within q-side-nav-nodes.

                                                                                                                                                                                      Updated by Ryan Bower