Skip to content

Tree Select for Angular

AngularForm Inputs

Form control for choosing one or several nodes of a hierarchy: a combobox-style field (aria-haspopup=tree) whose popup is a Tree View. Typing filters the tree while keeping the paths to matches; Down Arrow moves focus into the tree. Single mode closes on choice; multiple mode uses tri-state checkboxes and shows the values as removable tags. Lazy children, a clear button, required validation, Form integration, and hidden inputs for native submission.

  • A tree in a fieldA combobox whose popup is a Tree View: type to filter, Down Arrow to move into the tree.
  • One or manySingle choice closes on selection; multiple choice uses tri-state checkboxes and removable tags.
  • Lazy hierarchiesChildren load on expansion; labels of unloaded values come from valueLabels.
  • A real form controlRequired validation, Form integration, a clear button, and hidden inputs for native submission.

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

import { Component, signal } from '@angular/core';
import { AuiTreeSelect } from '@absoluteui/angular/tree-select';
import type { TreeNode } from '@absoluteui/components/tree-select';
@Component({
selector: 'app-department-field',
imports: [AuiTreeSelect],
template: `<aui-tree-select label="Department" name="department" [nodes]="nodes" [(value)]="value"></aui-tree-select>`,
})
export class DepartmentFieldComponent {
readonly nodes: TreeNode[] = [{ id: 'eng', label: 'Engineering', children: [{ id: 'web', label: 'Web' }] }];
readonly value = signal<string[] | undefined>(['web']);
}
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 { AuiTreeSelect } from '@absoluteui/angular/tree-select';

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

Class AuiTreeSelect; template reference #ref="auiTreeSelect".

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

Angular forms: implements ControlValueAccessor and Validator; the form value is string[]. Bind [formControl], formControlName, or [(ngModel)]; validation messages of the component report through the aui error key. See Forms.

Input Type Default Description
label string Required. Visible label (accessible name).
nodes readonly TreeNode[] Required. The tree (see Tree View).
mode TreeSelectMode 'single' Single choice or multiple choice with checkboxes and tags.
name string Form field name; one hidden input per selected id.
placeholder string Placeholder while nothing is selected.
description string Help text below the field.
required boolean false At least one value is required.
disabled boolean false Not interactive and not submitted by Form.
readOnly boolean false Focusable, but the value cannot change.
invalid boolean false Show errorMessage as an external error.
errorMessage string Message shown while invalid is true.
clearable boolean true Show a button that clears the selection.
selectableParents boolean true Single mode: parents can be chosen; otherwise choosing a parent opens it.
cascade boolean true Multiple mode: checking a parent checks its descendants.
expanded readonly string[] Ids expanded in the popup tree (paths to the value are expanded too).
loadChildren (node: TreeNode, context: TreeViewLoadContext) => Promise<readonly TreeNode[]>) | nul Lazy children (see Tree View).
valueLabels Readonly<Record<string, string>> Labels of selected ids whose nodes are not loaded yet.
popupHeight string '16rem' Block size of the tree in the popup.
direction "ltr" | "rtl" Popup placement and tree arrow keys.
density Density Row height of the popup tree.
icons Partial<TreeSelectIcons> Expand, clear, remove, and error icons.
openOnFocus boolean false Open the popup when the field receives focus.
locale string 'en-US' Locale of messages and filtering.
Model Type Change output Description
[(value)] string[] (valueChange) The value: [(value)] without forms; with Angular forms, bind the form control instead.
Output Payload Description
(changed) TreeSelectChangeDetail The user changed the value: { value, added, removed }. Re-emits aui-change.
(valueInput) { query: string } The search text changed. Re-emits aui-input.
(opened) null The popup opened. Re-emits aui-open.
(closed) null The popup closed. Re-emits aui-close.

Call them through a viewChild query or a template reference.

Method Description
open(): void Open the popup.
close(): void Close the popup.
getFormValue(): string | string[] | null | undefined The id (single) or ids (multiple) for Form.
reportValidity(): boolean | undefined Show messages and return validity.
setCustomError(message: string | null): void External error; null clears it.
focus(): void Focus the field.
reset(): void Restore the initial value and clear interaction state.

Pattern: WAI-ARIA 1.2 combobox with a tree popup (aria-haspopup=tree). The field keeps focus while typing; Down Arrow moves DOM focus into the popup tree, which follows the APG tree pattern (see Tree View); Escape returns focus to the field.

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 Select: Accessibility and performance.