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.
<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.
<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.
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.
<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.
<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.
<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.
<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:
Composite API
q-field-group-root
<fieldset> element.| Prop | Type | Default |
|---|---|---|
Adds padding at the start of the items container. | boolean | false |
Marks the group as invalid. | boolean | false |
Layout direction for items. | | 'vertical' | 'vertical' |
The size of the group items. | | 'sm' | 'md' |
booleanboolean| 'vertical'
| 'horizontal'
| 'sm'
| 'md'
| 'lg'
| Attribute / Property | Value |
|---|---|
class | 'qui-field-group__root' |
data-invalid | |
data-part | 'root' |
data-scope | 'field-group' |
class'qui-field-group__root'data-invaliddata-part'root'data-scope'field-group'q-field-group-label
<legend> element inside a fieldset.| Attribute / Property | Value |
|---|---|
class | 'qui-field-group__label' |
data-part | 'label' |
data-scope | 'field-group' |
class'qui-field-group__label'data-part'label'data-scope'field-group'q-field-group-items
| Attribute / Property | Value |
|---|---|
class | 'qui-field-group__items' |
data-indented | |
data-orientation | | 'vertical' |
data-part | 'items' |
data-scope | 'field-group' |
data-size | | 'sm' |
class'qui-field-group__items'data-indenteddata-orientation| 'vertical'
| 'horizontal'
data-part'items'data-scope'field-group'data-size| 'sm'
| 'md'
| 'lg'
q-field-group-hint
| Attribute / Property | Value |
|---|---|
class | 'qui-field-group__hint' |
data-part | 'hint' |
data-scope | 'field-group' |
class'qui-field-group__hint'data-part'hint'data-scope'field-group'q-field-group-error-text
| Prop | Type | Default |
|---|---|---|
Error indicator icon. | | LucideIconData | CircleAlert |
| LucideIconData
| string
| Attribute / Property | Value |
|---|---|
class | 'qui-field-group__error-text' |
data-part | 'error-text' |
data-scope | 'field-group' |
class'qui-field-group__error-text'data-part'error-text'data-scope'field-group'