Skip to content

Checkbox Group for Angular

AngularForm Inputs

Several related, independent choices in a <fieldset> + <legend>, built on native checkboxes that share one field name, with group help text, required and min/max selection validation, and one localized validation message.

  • Grouped choicesRelated checkboxes in a fieldset and legend that share one field name.
  • Selection limitsRequired, minimum, and maximum selection rules with one group message.
  • Option detailsEach option can have a description or be disabled.
  • Flexible layoutVertical or horizontal orientation.

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

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 });
}
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 { AuiCheckboxGroup } from '@absoluteui/angular/checkbox-group';

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

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.

Pattern: Native <fieldset> + <legend> grouping native checkboxes, each with a <label for> (HTML; WAI-ARIA APG Checkbox).

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