Checkbox
One or many independent on or off choices, usually sent with a form.
In Multi-brand
See it live
npm run storybookWhen to use it
In Multi-brand: Terms and preferences.
- Use it when: Agreeing, picking many, optional extras; the choice waits for the form.
- Not when: Exactly one of a short set (radio group), or a setting that applies at once (switch).
Instead:
- Radio group: One choice only.
- Switch: Applies at once.
- Select: Many options in a compact list.
Words
- Shared structure: object, state, next step.
- Brand tone lives in headlines and marketing copy, not in errors.
- Errors and confirmations read the same in every brand.
- Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Cancelcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Get started
See Voice and tone for the whole voice.
Accessibility and keyboard
| Keyboard | What happens | Not |
|---|---|---|
| undefined | Space checks and unchecks. | undefined |
Test before you ship:
- Each checkbox has a visible label that is part of the hit area. undefined
Use it in code
npx open-ds add checkbox
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Checkbox reads 11 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Checkbox's tokens to change Checkbox alone.
Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Shared | ||
| Button focus ring Changes with theme on focus | component.button.focus-ringcolor.border.focusvar(--button-focus-ring) | Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F |
| Input background Changes with theme | component.input.backgroundcolor.surface.defaultvar(--input-background) | Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.dark.50:#0F172ABirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.dark.50:#0F172ACoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.dark.50:#0F172A |
| Control checked Changes with theme when on | component.control.checkedcolor.action.primaryvar(--control-checked) | Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F |
| Control track Changes with theme | component.control.trackcolor.border.strongvar(--control-track) | Aster Lightslate-deep.light.500:#64748BAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.500:#64748BBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.500:#64748BCoral Darkslate-deep.dark.400:#96A3B5 |
| Control thumb Changes with theme when on | component.control.thumbcolor.surface.defaultvar(--control-thumb) | Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.dark.50:#0F172ABirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.dark.50:#0F172ACoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.dark.50:#0F172A |
| Control radius Changes with theme | component.control.radiusradius.badgevar(--control-radius) | Aster Lightradius.4:0.25remAster Darkradius.4:0.25remBirch Lightradius.999:9999pxBirch Darkradius.999:9999pxCoral Lightradius.999:9999pxCoral Darkradius.999:9999px |
| Checkbox | ||
| Size | component.checkbox.sizesize.iconvar(--checkbox-size) | size.16:1rem |
| Border width | component.checkbox.border-widthborder-width.defaultvar(--checkbox-border-width) | border-width.1:1px |
| Focus on focus | component.checkbox.focusborder-width.focusvar(--checkbox-focus) | border-width.2:2px |
| Disabled when disabled | component.checkbox.disabledopacity.disabledvar(--checkbox-disabled) | opacity.40:0.4 |
| Canvas Changes with theme on focus | component.checkbox.canvascolor.surface.canvasvar(--checkbox-canvas) | Aster Lightslate-deep.light.50:#F8FAFCAster Darkslate-deep.dark.0:#020617Birch Lightslate-deep.light.50:#F8FAFCBirch Darkslate-deep.dark.0:#020617Coral Lightslate-deep.light.50:#F8FAFCCoral Darkslate-deep.dark.0:#020617 |