Skip to content

Forms

CheckboxGroup

Several independent yes/no choices under one question, as a fieldset with a legend.

  • Experimental
  • Keyboard not tested yet
  • Screen reader not tested yet

Playground

Change the props. The controls come from the documented props.
Contact me by
tsx
<CheckboxGroup
  label="Contact me by"
  name="playground-channels"
  options={[{ value: "email", label: "Email" }, { value: "phone", label: "Phone" }]}
/>

Usage

When to use

Use a checkbox group when several options under one question can be true at the same time, such as which events send an email or which channels a contact prefers.

When not to use

  • For exactly one choice out of several: use RadioGroup (two to five options) or Select.
  • For a single yes/no, such as consent: use Checkbox.

How it works

A fieldset with a legend holds one Checkbox per option. All options share one name; the form receives every checked value under it. Each box toggles on its own with Space, and Tab moves from box to box.

Content guidelines

Phrase the legend as the start of a sentence the options complete: “Email me when” followed by “A new request arrives”. Keep options parallel in grammar and roughly the same length.

Do and don’t

Do
  • Use it when several options can be true at once, such as which events send an email.
  • Name the group by the question, e.g. “Email me when”.
Don’t
  • Don't use it for one choice out of several; use RadioGroup.
  • Don't use a group for a single yes/no; use Checkbox.

Anatomy

The parts of the component and what each one does, as in the playground above.
  1. legendThe question, 14px medium.
  2. optionA Checkbox per option, 24px box with a check mark.
  3. hintHelp text under the legend.

Examples

Type-checked, and the same code goes into the AI manifest. Import: import { CheckboxGroup } from "@/ds";

Email notifications

Email me when

Sent on Monday morning.

Props

Checked against the component's TypeScript type on every build.
CheckboxGroup props
NameTypeDefaultDescription
label (required)string–What the options have in common, rendered as the legend.
name (required)string–Form field name; every checked value is sent under it.
options (required)CheckboxOption[]–value, label and an optional hint per option.
defaultValuesstring[]–Values checked first.
optionalbooleanfalseAdds “(optional)” to the legend.
hintstring–Help text under the legend.
disabledbooleanfalseDisables every option.

Tokens used

Derived from the utility classes in the component's source. Copy a class with one click.
Tokens used by CheckboxGroup
TokenTierValueUtility
spacing.1semantic4px
spacing.2semantic8px
spacing.3semantic12px
text.primarysemantic#0A0A0B
text.secondarysemantic#555555
type.small.sizesemantic14px
weight.mediumsemantic500
weight.regularsemantic400

Accessibility

What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
Testing status by check
CheckHowStatus
axe-core rulesAutomated on every npm run check, at desktop and mobile widthRuns on every build
KeyboardAutomated Playwright test (scripts/keyboard.mjs)Not tested yet
Screen readerManualNot tested yet

Keyboard

CheckboxGroup keyboard interactions
KeyAction
TabMoves to the next option in the group.
SpaceChecks or unchecks the focused option.

Semantics and focus

  • <fieldset> and <legend> name the group; screen readers read the legend with each option.