Checkbox Group

Groups related checkboxes with a shared label, hint text, and validation state.

import {CheckboxGroupModule} from "@qualcomm-ui/angular/checkbox-group"

Examples

Simple

Use the simple API to create a checkbox group using minimal markup.

If you omit the label, you should provide an aria-label to keep your group accessible.

Notifications
Select at least one
<fieldset hint="Select at least one" label="Notifications" q-checkbox-group>
  <label label="Email" q-checkbox></label>
  <label label="SMS" q-checkbox></label>
  <label label="Push" q-checkbox></label>
</fieldset>

Composite

The composite API exposes FieldGroup directives for granular control over the group structure.

Notifications
Select at least one
<fieldset q-field-group-root>
  <legend q-field-group-label>Notifications</legend>
  <div q-field-group-items>
    <label label="Email" q-checkbox></label>
    <label label="SMS" q-checkbox></label>
    <label label="Push" q-checkbox></label>
  </div>
  <div q-field-group-hint>Select at least one</div>
</fieldset>

Size

The size input controls the size of child checkboxes. Available sizes are sm, md (default), and lg.

Small
Medium
Large
import {Component} from "@angular/core"

import {CheckboxModule} from "@qualcomm-ui/angular/checkbox"
import {CheckboxGroupModule} from "@qualcomm-ui/angular/checkbox-group"

@Component({
  imports: [CheckboxGroupModule, CheckboxModule],
  selector: "checkbox-group-size-demo",
  template: `
    <div class="flex flex-row gap-8">
      <fieldset label="Small" q-checkbox-group size="sm">
        <label label="Email" q-checkbox></label>
        <label label="SMS" q-checkbox></label>
      </fieldset>
      <fieldset label="Medium" q-checkbox-group size="md">
        <label label="Email" q-checkbox></label>
        <label label="SMS" q-checkbox></label>
      </fieldset>
      <fieldset label="Large" q-checkbox-group size="lg">
        <label label="Email" q-checkbox></label>
        <label label="SMS" q-checkbox></label>
      </fieldset>
    </div>
  `,
})
export class CheckboxGroupSizeDemo {}

Orientation

Use the orientation input to control the layout direction of the group. Options include:

  • vertical: checkboxes are laid out in a column (default).
  • horizontal: checkboxes are laid out in a row.
Notifications
<fieldset label="Notifications" orientation="horizontal" q-checkbox-group>
  <label label="Email" q-checkbox></label>
  <label label="SMS" q-checkbox></label>
  <label label="Push" q-checkbox></label>
</fieldset>

Indented

Set indented to add padding at the start of the group.

Notifications
<fieldset indented label="Notifications" q-checkbox-group>
  <label label="Email" q-checkbox></label>
  <label label="SMS" q-checkbox></label>
  <label label="Push" q-checkbox></label>
</fieldset>

Hint

Use hint to add additional guidance or context to the user below the group.

Notifications
Select at least one
<fieldset hint="Select at least one" label="Notifications" q-checkbox-group>
  <label label="Email" q-checkbox></label>
  <label label="SMS" q-checkbox></label>
  <label label="Push" q-checkbox></label>
</fieldset>

Error Text

Set invalid and errorText to display validation errors. The error text replaces the hint when present.

Notifications
Select at least one option
<fieldset
  errorText="Select at least one option"
  invalid
  label="Notifications"
  q-checkbox-group
>
  <label label="Email" q-checkbox></label>
  <label label="SMS" q-checkbox></label>
</fieldset>

API

q-checkbox-group

The q-checkbox-group directive extends q-field-group-root with the following inputs:

Groups multiple checkboxes with a label, hint, and error text.
PropType
Error message displayed when invalid.
string
Helper text displayed below items. Hidden when invalid.
string
Group label text.
string
Type
string
Description
Error message displayed when invalid.
Type
string
Description
Helper text displayed below items. Hidden when invalid.
Type
string
Description
Group label text.

Composite API

q-field-group-root

Root container for the field group. Use with a <fieldset> element.
PropTypeDefault
Adds padding at the start of the items container.
boolean
false
Marks the group as invalid.
boolean
false
Layout direction for items.
| 'vertical'
| 'horizontal'
'vertical'
The size of the group items.
| 'sm'
| 'md'
| 'lg'
'md'
Type
boolean
Description
Adds padding at the start of the items container.
Type
boolean
Description
Marks the group as invalid.
Type
| 'vertical'
| 'horizontal'
Description
Layout direction for items.
Type
| 'sm'
| 'md'
| 'lg'
Description
The size of the group items.

q-field-group-label

Label for the field group. Use with a <legend> element inside a fieldset.

q-field-group-items

Container for the field group items.

q-field-group-hint

Hint text displayed below the field group items.

q-field-group-error-text

Error message displayed when the field group is invalid.
PropTypeDefault
Error indicator icon.
| LucideIconData
| string
CircleAlert
Type
| LucideIconData
| string
Description
Error indicator icon.
Last updated on by Olaf Kappes