Skip to content

Checkbox ​

Turns one option on or off, or selects an item in a list.

base-baseinputcheckbox--defaultOpen in Storybook ↗

When to use ​

  • Selecting items in a list for a bulk action.
  • An option that is on or off and takes effect when the form or action is submitted: Include in export.
  • Several options in a filter, where any combination is allowed.

When not to use ​

  • Exactly one of several options: use a dropdown.
  • A setting that applies straight away: use a toggle.

Anatomy ​

  1. Hit area: the clickable square around the box, --checkbox-hit-area (the touch-target minimum, --touch-target-min). Dense lists such as filter options use the compact size, --checkbox-hit-area-compact.
  2. Box: rounded, --border-width-control neutral border. Checked, it fills with the commit colour and shows a white check.
  3. Label (optional): a real <label>; clicking it toggles the box.

Variants ​

VariantWhere
Defaultforms, list rows
Compactdense option lists, such as filters
Without labellist rows and table headers, where the column or row says what is selected

States ​

StateWhat you seeTrigger
Uncheckedempty box, neutral border—
Checkedcommit fill with a white checkclick, Space
Partialcommit fill with a dashsome, not all, items below it are selected
Focusfocus ring around the boxkeyboard
Disabledmuted grey box and label, no pointer; a checked box shows a grey checkoption unavailable
Requiredchecked and locked, with a warning icon after the labelthe item must be included
Limit reachedunchecked boxes are disabledthe selection limit of a bulk action is reached
base-baseinputcheckbox--statesOpen in Storybook ↗

Keyboard & accessibility ​

  • It is a native <input type="checkbox">: Tab reaches it, Space toggles it.
  • With a visible label, the label is linked to the box and names it.
  • Without a visible label it needs an aria-label, such as Select row.
  • A partial selection is exposed as the native indeterminate state.
  • A required box is disabled, and its warning icon carries the tooltip This checkbox is required.

Content ​

  • Labels describe the option, not the action: Include in export, not Click to include.
  • Keep labels short and positive; avoid negatives such as Don't include.

Button · Colour · Accessibility

Powered by Elody - Open Source Semantic Data Platform