Skip to content

Tag Group for Angular

AngularData display

Interactive tags such as applied filters, recipients, or labels on a record: removable, selectable (single or multiple), or both. A grid with one row per tag: one tag in the tab sequence, arrow keys between tags, Space selects, Delete or Backspace removes.

  • Selectable tagsNo selection, single, or multiple selection with a change event.
  • RemovableRemove tags with a button or the keyboard; the remove event can be cancelled.
  • Grid keyboard modelArrow keys move between tags and their remove buttons.
  • Disabled tagsIndividual tags can be disabled while staying visible.

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

import { Component } from '@angular/core';
import type { TagGroupItem, TagGroupRemoveDetail } from '@absoluteui/components/tag-group';
import { AuiTagGroup } from '@absoluteui/angular/tag-group';
@Component({
selector: 'app-filters',
imports: [AuiTagGroup],
template: `<aui-tag-group label="Applied filters" [items]="filters" [removable]="true" (removed)="remove($event)"></aui-tag-group>`,
})
export class FiltersComponent {
filters: TagGroupItem[] = [{ value: 'london', label: 'London' }, { value: 'remote', label: 'Remote' }];
remove({ value }: TagGroupRemoveDetail): void {
this.filters = this.filters.filter((f) => f.value !== value);
}
}
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 { AuiTagGroup } from '@absoluteui/angular/tag-group';

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

Class AuiTagGroup; template reference #ref="auiTagGroup".

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

Angular forms: implements ControlValueAccessor; 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. Accessible name of the group.
items readonly TagGroupItem[] Required. Tags: { value, label, disabled? } (unique values, at most 1,000).
removable boolean false Remove button per tag; Delete and Backspace remove the focused tag.
selection TagGroupSelection 'none' Selection mode.
size TagGroupSize 'md' Tag size.
icons Partial<TagGroupIcons> Icon slot overrides.
locale string 'en-US' Locale of the remove label and announcement.
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) TagGroupChangeDetail The user changed the selection (or removed a selected tag): { value }. Re-emits aui-change.
(removed) TagGroupRemoveDetail The user removes a tag: { value, item }. Prevent it to keep the tag. Re-emits aui-remove.

Call them through a viewChild query or a template reference.

Method Description
focus(): void Focus the tag in the tab sequence.

Pattern: Grid list (as in the React Aria TagGroup): role=grid with one row per tag and one gridcell per row; roving tabindex over the rows.

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