Skip to content

Tree View for Angular

AngularNavigation

Hierarchical list following the WAI-ARIA APG tree pattern: expand and collapse, single or multiple selection, checkboxes with tri-state parents, lazy children loaded through an async hook with loading and error states, type-ahead, Home/End and * to expand siblings, drag-and-drop reordering and reparenting with a keyboard alternative (Ctrl+X / Ctrl+V, Alt+Up / Alt+Down), inline rename in a text input, icons per node, and a filter that keeps the paths to matches visible. Visible nodes are virtualized on the shared windowing engine, so trees with 10,000+ visible nodes stay fast.

  • APG tree, every keyArrows, Home, End, type-ahead, and * to expand siblings, with one tab stop and RTL-aware arrows.
  • Lazy childrenAn async hook loads children on first expansion, with a busy state, an error message, and retry.
  • Tri-state checkboxesChecking a parent checks its descendants; partly checked parents show the mixed state.
  • Move by drag or keyboardDrag to reorder or reparent, or cut and paste with Ctrl+X and Ctrl+V; every move is cancelable.
  • Rename and filterF2 renames in a text input; a filter keeps the paths to matches visible and highlights them.
  • 10,000+ visible nodesRows are virtualized on the shared windowing engine; the focused node always stays rendered.

Behavior, design tokens, and limitations are described on the Tree View page; this page covers the Angular API.

import { Component, signal } from '@angular/core';
import { AuiTreeView } from '@absoluteui/angular/tree-view';
import type { TreeNode } from '@absoluteui/components/tree-view';
@Component({
selector: 'app-org-tree',
imports: [AuiTreeView],
template: `<aui-tree-view label="Organization" selection="single" [nodes]="nodes" [(selected)]="selected" [(expanded)]="expanded"></aui-tree-view>`,
})
export class OrgTreeComponent {
readonly nodes: TreeNode[] = [{ id: 'acme', label: 'Acme', children: [{ id: 'eng', label: 'Engineering' }, { id: 'ops', label: 'Operations' }] }];
readonly selected = signal<readonly string[] | undefined>(['eng']);
readonly expanded = signal<readonly string[] | undefined>(['acme']);
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiTreeView } from '@absoluteui/angular/tree-view';

Defaults for every instance: provideAbsoluteUIConfig({ components: { treeView: { ... } } }) (see Configuration).

Class AuiTreeView; template reference #ref="auiTreeView".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Input Type Default Description
label string Required. Accessible name of the tree.
nodes readonly TreeNode[] Required. The nodes ({ id, label, icon?, expandedIcon?, children?, hasChildren?, disabled? }); ids must be unique.
selection TreeViewSelection 'none' Selection mode.
checkboxes boolean false Show a checkbox per node; Space toggles it.
cascade boolean true Checking a parent checks its descendants; parents show the mixed state.
loadChildren (node: TreeNode, context: TreeViewLoadContext) => Promise<readonly TreeNode[]>) | nul Loads the children of a node with hasChildren on first expansion; receives an AbortSignal.
draggable boolean false Nodes can be moved by dragging and with Ctrl+X / Ctrl+V and Alt+Up / Alt+Down.
canDrag (node: TreeNode) => boolean Which nodes may be moved.
canDrop (source: TreeNode, target: TreeNode | null, position: TreeViewDropPosition) => boolean Whether a node may be dropped before, inside, or after a target.
renamable oolean | ((node: TreeNode) => boolean false Nodes can be renamed with F2 or a double click on the label.
filter string '' Show matching nodes and the paths to them (case and accent insensitive); matches are highlighted.
filterBy (node: TreeNode, query: string) => boolean Custom filter match instead of the label match.
itemHeight number Row height in pixels (24 to 200). Default by density: 32, 40, or 48.
height string | null '20rem' Block size of the scroll area as a CSS length, or null to fill the host.
empty string 'No items' Text shown when there are no nodes.
direction "ltr" | "rtl" Writing direction for the arrow keys. Default: the computed direction of the host.
icons Partial<TreeViewIcons> Twisty, loading, and error icons.
overscan number '8' Rows rendered beyond each edge of the visible area (0 to 100).
locale string 'en-US' Locale of messages, filtering, and type-ahead.
density Density 'comfortable' Default row height when itemHeight is not set.
Model Type Change output Description
[(selected)] readonly string[] (selectedChange) Ids of the selected nodes.
[(checked)] readonly string[] (checkedChange) Ids of the checked nodes.
[(expanded)] readonly string[] (expandedChange) Ids of the expanded nodes.
Output Payload Description
(selectionChanged) TreeViewSelectDetail The user changed the selection: { selected, id }. Re-emits aui-select.
(changed) TreeViewChangeDetail The user toggled a checkbox: { checked, indeterminate, id }. Re-emits aui-change.
(expandToggled) TreeViewExpandDetail The user expanded or collapsed a node: { id, open, expanded }. Re-emits aui-expand.
(moved) TreeViewMoveDetail A node is about to move (drag or keyboard): { id, parentId, index, previousParentId, previousIndex, source }; preventDefault() keeps it in place. Re-emits aui-move.
(renamed) TreeViewRenameDetail A node is about to be renamed: { id, label, previousLabel }; preventDefault() keeps the old label. Re-emits aui-rename.
(activated) TreeViewActivateDetail A node was activated with Enter or a double click: { id, node }. Re-emits aui-activate.
(loadError) TreeViewLoadErrorDetail loadChildren rejected: { id, error }. Re-emits aui-load-error.
(rangeChange) { start: number; end: number } The visible rows changed. Re-emits aui-range-change.

Call them through a viewChild query or a template reference.

Method Description
expand(id: string): Promise<void> | undefined Expand a node and its ancestors, loading lazy children.
collapse(id: string): void Collapse a node.
expandAll(): void Expand every loaded parent.
collapseAll(): void Collapse every node.
setSelected(ids: readonly string[]): void Select by ids (no event).
focusNode(id: string): void Focus a node, expanding its ancestors and scrolling it into view.
scrollToNode(id: string, align?: "auto" | "start" | "end" | "center" | undefined): void Scroll a node into view, expanding its ancestors.
reload(id: string): Promise<void> | undefined Load a lazy node’s children again.
rename(id: string): void Start renaming a node.
getNode(id: string): TreeNode | null | undefined A node of the current tree.
getParentId(id: string): string | null | undefined The id of a node’s parent.
getItemElement(id: string): HTMLElement | null | undefined The rendered treeitem of a node, or null.

Pattern: WAI-ARIA APG Tree View with a flat DOM: every visible node is a treeitem directly inside the tree and carries aria-level, aria-posinset, and aria-setsize (only part of the tree is rendered). Roving tabindex keeps one tab stop; the focused node always stays rendered.

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Tree View: Accessibility and performance.