Checkbox
One or many independent on or off choices, usually sent with a form.
In Brand expressive
See it live
npm run storybookWhen to use it
In Brand expressive: An optional extra in the sign-up form, such as a launch reminder. Not as a second action beside sign-up.
- 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
- Headlines are short and bold. Three to six words.
- Verbs that move: Join, Try, Go.
- Playful in headlines, plain in errors.
- Use: Join, Drop, Go, Love. Avoid: Synergy, Leverage, Kindly.
The labels components use, from the voice tokens:
content.action.commit: Gocontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Explore the drop
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.
Brand expressive decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ 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) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Input background Changes with theme | component.input.backgroundcolor.surface.defaultvar(--input-background) | Lighttaupe.light.0:#FFFFFFDarktaupe.dark.50:#1F1411 |
| Control checked Changes with theme when on | component.control.checkedcolor.action.primaryvar(--control-checked) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Control track Changes with theme | component.control.trackcolor.border.strongvar(--control-track) | Lighttaupe.light.500:#8A6F63Darktaupe.dark.400:#B5988A |
| Control thumb Changes with theme when on | component.control.thumbcolor.surface.defaultvar(--control-thumb) | Lighttaupe.light.0:#FFFFFFDarktaupe.dark.50:#1F1411 |
| Control radius | component.control.radiusradius.badgevar(--control-radius) | radius.999:9999px |
| Checkbox | ||
| Size | component.checkbox.sizesize.iconvar(--checkbox-size) | size.20:1.25rem |
| Border width | component.checkbox.border-widthborder-width.defaultvar(--checkbox-border-width) | border-width.2:2px |
| Focus on focus | component.checkbox.focusborder-width.focusvar(--checkbox-focus) | border-width.3:3px |
| 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) | Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09 |