Forms
Checkbox
A single yes/no choice, e.g. consent or an option that can be switched on.
- Experimental
- Keyboard tested
- Screen reader not tested yet
Playground
Change the props. The controls come from the documented props.
<Checkbox label="Send me a copy of the request." name="playground-consent" />States
Every variant in every state, side by side. Hover, pressed and focus are shown statically; the default state is interactive.
Error: Confirm “Option” to continue.
Usage
When to use
Use a checkbox for one yes/no decision that the person makes independently: consent, an opt-in, a setting that is either on or off.
When not to use
- One answer out of several exclusive options: use RadioGroup.
- A setting that takes effect immediately, without a submit: that is a switch, which the system doesn't have yet. Report the gap.
How it works
A native checkbox with a 24px box, the WCAG 2.2 minimum target. The label is clickable. Checked fills the box with ink and shows a cream check mark. With required, Form reports an unchecked box like any other invalid field.
Content guidelines
Write the label as the statement that becomes true when the box is checked: “Send me a copy”, not “Copy”. Use the hint for consequences the label can't carry, such as where the copy goes.
Do and don’t
Do
- Write the label as the statement that becomes true when checked.
Don’t
- Don't use a checkbox for one of several exclusive options; use RadioGroup.
Anatomy
The parts of the component and what each one does, as in the playground above.
- input-field24px box, border.control; checked fills with ink.
- indicatorCheck mark in cream, only when checked.
- labelBody text next to the box.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { Checkbox } from "@/ds";
Consent
With hint
The copy goes to the email address above.
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| label (required) | string | – | Visible label; clicking it toggles the box. |
| hint | string | – | Help text under the label. |
| error | string | – | Error message; overrides native validation. |
| messages | ValidationMessages | – | Texts for native validation, e.g. required consent. |
| …input | InputHTMLAttributes | – | Native attributes such as name, required, defaultChecked. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| choice.border | component | #8A8578 | |
| choice.checked | component | #0A0A0B | |
| choice.mark | component | #FAFAF7 | |
| choice.radius | component | 4px | |
| choice.size | component | 24px | |
| input.bg | component | #FAFAF7 | |
| input.errorRing | component | #C6492E | |
| focus | semantic | #C6492E | |
| spacing.1 | semantic | 4px | |
| spacing.3 | semantic | 12px | |
| state.disabled | semantic | 0.5 | |
| surface.page | semantic | #FAFAF7 | |
| text.primary | semantic | #0A0A0B | |
| text.secondary | semantic | #555555 | |
| type.body.size | semantic | 16px | |
| type.small.size | semantic | 14px |
Accessibility
What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Tested |
| Screen reader | Manual | Not tested yet |
Keyboard
| Key | Action |
|---|---|
| Tab | Moves focus to the box. |
| Space | Checks or unchecks it. |
Semantics and focus
- Native checkbox: Space toggles it, screen readers announce checked state.
- 24px target, the WCAG 2.2 minimum.
Contrast
| Pairing | Ratio (x:1) | Minimum | Status |
|---|---|---|---|
| text.primary on surface.page | 18.92 | 4.5 | Pass |
| text.secondary on surface.page | 7.13 | 4.5 | Pass |
| accent.default on surface.page | 4.57 | 4.5 | Pass |
| text.onInverse on surface.inverse | 18.92 | 4.5 | Pass |
| border.control on surface.page | 3.52 | 3.0 | Pass |
| focus on surface.page | 4.57 | 3.0 | Pass |
| surface.inverse on text.onInverse | 18.92 | 4.5 | Pass |
| border.control on surface.inverse | 5.38 | 3.0 | Pass |
| accent.default on surface.inverse | 4.14 | 3.0 | Pass |
| surface.inverse on accent.default | 4.14 | 3.0 | Pass |