Groups related checkboxes or toggles under a shared label.
Usage
Wrap related checkboxes or toggles in <orb-checkbox-group> to give them a shared label. The group has the group role, takes its accessible name from the label, and takes its description from the note. Each control still submits its own value with a form.
<orb-checkbox-group label="Notifications" note="Choose how we contact you.">
<orb-checkbox name="email" checked="true">Email</orb-checkbox>
<orb-checkbox name="sms">Text message</orb-checkbox>
<orb-checkbox name="push">Push notification</orb-checkbox>
</orb-checkbox-group>
Toggles
The group works the same way with toggles.
<orb-checkbox-group label="Privacy">
<orb-toggle name="analytics" checked>Share usage analytics</orb-toggle>
<orb-toggle name="personalization">Personalized recommendations</orb-toggle>
</orb-checkbox-group>
Mode
Controls are stacked in a column by default. Set mode="row" to put them in a row that wraps when there isn’t enough room.
<orb-checkbox-group label="Days" mode="row">
<orb-checkbox name="mon">Mon</orb-checkbox>
<orb-checkbox name="tue">Tue</orb-checkbox>
<orb-checkbox name="wed">Wed</orb-checkbox>
<orb-checkbox name="thu">Thu</orb-checkbox>
<orb-checkbox name="fri">Fri</orb-checkbox>
</orb-checkbox-group>
Slots
Use the label and note slots when the label or note needs HTML. The slotted content still names and describes the group.
<orb-checkbox-group>
<orb-label slot="label">Interests <small>(optional)</small></orb-label>
<orb-checkbox name="design">Design</orb-checkbox>
<orb-checkbox name="engineering">Engineering</orb-checkbox>
<orb-note slot="note">See the <a href="#">privacy policy</a> for how we use this.</orb-note>
</orb-checkbox-group>
Accessibility
Inspect the group in your browser’s accessibility tree. It should have the group role, the label as its name, and the note as its description. A screen reader announces the group name when focus moves into the first control.
Properties
label
| Description | Label that shows above the controls |
|---|---|
| Attribute | label |
| Type | string |
| Default | undefined |
mode
| Description | Lays the controls out in a column or a wrapping row |
|---|---|
| Attribute | mode |
| Type | "column" | "row" |
| Default | "column" |
note
| Description | Additional info that shows below the controls |
|---|---|
| Attribute | note |
| Type | string |
| Default | undefined |
Slots
| Slot | Description |
|---|---|
| The checkboxes or toggles in the group | |
"label" |
Label content, used instead of the label attribute |
"note" |
Note content, used instead of the note attribute |
Shadow Parts
| Part | Description |
|---|---|
"content" |
The wrapper around the default slot |