Skip to content

Checkbox Group for Angular

import { AuiCheckboxGroup } from '@absoluteui/angular/checkbox-group';

Styles are included with the component. Behavior, keyboard and screen-reader support, design tokens, and limitations are described on the Checkbox Group page; this page covers the Angular API.

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

import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { AuiCheckboxGroup } from '@absoluteui/angular/checkbox-group';
@Component({
selector: 'app-preferences',
imports: [ReactiveFormsModule, AuiCheckboxGroup],
template: `<aui-checkbox-group label="Notifications" [options]="channels" [required]="true" [formControl]="notify"></aui-checkbox-group>`,
})
export class PreferencesComponent {
readonly channels = [
{ value: 'email', label: 'Email' },
{ value: 'sms', label: 'SMS' },
];
readonly notify = new FormControl<string[]>([], { nonNullable: true });
}

Class AuiCheckboxGroup; template reference #ref="auiCheckboxGroup".

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. Legend text and accessible name of the group.
hideLabel boolean false Visually hide the legend; it remains the accessible name.
options readonly CheckboxGroupOption[] Required. Choices; values must be unique.
name string Form field name shared by every checkbox.
description string Group help text referenced by the fieldset’s aria-describedby.
required boolean false At least one option must be selected.
minSelected number Minimum selections once any option is selected (integer 1..options.length).
maxSelected number Maximum selections (integer 1..options.length).
orientation CheckboxGroupOrientation 'vertical' Layout of the options.
disabled boolean false Disables the whole group (fieldset disabled).
validate (value: string[]) => string | null Consumer validation; return a message to mark the selection invalid.
icons Partial<CheckboxGroupIcons> Icon slot overrides.
validationTiming ValidationTiming 'blur' When validation messages first appear; afterwards they update live.
locale string 'en-US' Message and number-formatting locale.
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) CheckboxGroupChangeDetail The user toggled an option. Re-emits aui-change.

Call them through a viewChild query or a template reference.

Method Description
reportValidity(): boolean | undefined Show messages now and return validity.
setCustomError(message: string | null): void External error; cleared when the selection changes.
getFormValue(): string[] | undefined Selected values for form serialization.
focus(): void Focus the first enabled checkbox.
reset(): void Restore the initial selection and clear dirty/touched/submitted state.