Skip to content

Cascader for Angular

AngularInputs

Selects a node in a hierarchy through cascading columns, such as country > state > city or category > subcategory. A trigger button opens a non-modal popup with a search box and one listbox per level; children can load lazily with loading, error, and retry states. Single or multiple selection; the trigger shows the selected path. A Form control with hidden inputs carrying the selected leaf values.

  • Cascading levelsOne named listbox per level, from country to state to city.
  • Lazy childrenLoad a level when it opens, with a loading state, abort on close, and retry.
  • Search across levelsType to list matching paths such as India / Karnataka / Bengaluru.
  • Single or multipleOne path in the trigger, or several as removable chips; any level with changeOnSelect.
  • Keyboard completeArrows within and between levels, reading-direction aware, Escape to close.

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

import { Component } from '@angular/core';
import type { CascaderOption, CascaderValue } from '@absoluteui/components/cascader';
import { AuiCascader } from '@absoluteui/angular/cascader';
@Component({
selector: 'app-location-field',
imports: [AuiCascader],
template: `<aui-cascader label="Location" [options]="tree" [(value)]="location"></aui-cascader>`,
})
export class LocationFieldComponent {
readonly tree: CascaderOption[] = [{ value: 'in', label: 'India', children: [{ value: 'blr', label: 'Bengaluru' }] }];
location: CascaderValue = ['in', 'blr'];
}
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 { AuiCascader } from '@absoluteui/angular/cascader';

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

Class AuiCascader; template reference #ref="auiCascader".

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

Angular forms: implements ControlValueAccessor and Validator; the form value is CascaderValue. 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; names the trigger and the popup.
hideLabel boolean false Visually hide the label.
description string Help text, referenced by the trigger.
options readonly CascaderOption[] Required. The tree { value, label, children?, isLeaf?, disabled? }; sibling values are unique.
multiple boolean false Select several paths, shown as removable chips.
changeOnSelect boolean false Any node can be selected, not only leaves.
loadChildren (option: CascaderOption, context: CascaderLoadContext) => Promise<readonly CascaderOption[]> Loads a node’s children when it opens; aborted when the popup closes.
searchable boolean true Show a search box in the popup.
maxResults number '50' Maximum search results (1 to 1000).
levelLabels readonly string[] Accessible names of the levels (default Level 1, Level 2, …).
placeholder string Trigger text when nothing is selected (default Select).
clearable boolean true Show a clear button for a single selection that is not required.
name string Form field name: one hidden input per path with its leaf value.
required boolean false A selection is required.
disabled boolean false Disable the control.
readOnly boolean false Show the value; the popup does not open.
validate (value: CascaderValue) => string | null Consumer validation; return a message to mark the value invalid.
icons Partial<CascaderIcons> Icon overrides.
validationTiming ValidationTiming 'blur' When validation messages appear.
locale string 'en-US' Locale of messages and search matching.
direction "ltr" | "rtl" 'ltr' Reading direction for arrow keys and popup alignment.
Model Type Change output Description
[(value)] CascaderValue (valueChange) The value: [(value)] without forms; with Angular forms, bind the form control instead.
Output Payload Description
(changed) CascaderValueDetail The selection changed: { value, labels, validity }. Re-emits aui-change.
(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
show(): void Open the popup and focus the search box (or the first level).
close(restoreFocus?: boolean | undefined): void Close the popup; pending loads are aborted.
getFormValue(): string | string[] | null | undefined Leaf values for Form serialization.
reportValidity(): boolean | undefined Show messages now and return validity.
setCustomError(message: string | null): void Show or clear an external error.
focus(): void Focus the trigger.
reset(): void Restore the initial value and clear messages.

Pattern: A select-only combobox (a button element with role=combobox and aria-haspopup=“dialog”) opens a non-modal dialog (WAI-ARIA APG Dialog, non-modal variant) that holds a search box and one WAI-ARIA APG Listbox per level. Levels behave like the columns of a column browser: Up and Down move within a level, the inline arrow keys move between levels. A tree view was not used because only one branch per level is shown at a time.

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