Skip to content

Checkbox ​

A yes / no answer that's sent with a form, e.g. "Has a sibling at the school" or agreeing to terms.

Open in Storybook to try every prop.

When to use ​

  • A single yes / no question in a form, saved with the form's Save or Submit.
  • Agreeing to something before continuing.
  • "Select all" over a list of other checkboxes (with the indeterminate state).

When not to use ​

  • A setting that takes effect straight away: use Switch.
  • One choice from a few: use RadioGroup. Several choices from a long list: use Select with multiple.
  • Showing progress people don't tick themselves: use Checklist.

Anatomy ​

PartRequiredNotes
boxYes16px square, 4px corners, 1px border. Ticked: primary fill, white tick.
labelYesBeside the box. Pressing it ticks the box too.
descriptionNoSmaller text under the label.
messageNoError text under it all, sliding open like a field's.

Properties ​

PropertyTypeDefaultDescription
modelValueboolean | 'indeterminate'falseTicked or not; 'indeterminate' shows a dash.
labelstring—Required. Also the accessible name.
descriptionstring—
errorTextstring—Shows the error state and message.
name / valuestring— / "on"For native form submission.
requiredbooleanfalse
disabledbooleanfalse

No sizes or variants.

States ​

StateAppearanceNotes
UntickedWhite box, black 55% border.Darker than a text box's border, so the box meets 3:1 contrast.
HoveredBlack border.Web / desktop only.
TickedPrimary fill and border, white tick.
IndeterminatePrimary fill and border, white dash.Pressing it ticks it.
Focused2px focus ring, 2px out.Keyboard only.
ErrorRed border, red message with icon.
Disabled40% opacity.

Spacing and layout ​

  • Box to label: 8px. Label to description: 2px. The box is 2px down, level with the label's first line (20px).
  • Stacked checkboxes: 8px apart. Children of a "select all": indented 24px (box + gap).

Behaviour ​

  • Space ticks / unticks. Pressing the box or label does the same.
  • The whole row is pressable: the box, its label and its description. The description is not part of the accessible name; it stays the description.

Accessibility ​

  • Native semantics: role="checkbox" with aria-checked (mixed when indeterminate), named by its <label>.
  • Description and error are linked with aria-describedby; errors set aria-invalid and are announced.

Platform adaptation ​

PlatformImplementationDifferences
Web / desktop (Vue)Checkbox.vueReka UI Checkbox.
iOS (SwiftUI)—Toggle with a checkbox style (iOS has no native checkbox).
Android (Compose)—Checkbox / TriStateCheckbox in a row with the label.

Tokens used ​

TokenUsed for
color-primaryTicked fill and border
color-redError border and text
color-focusFocus ring

Do / Don't ​

DoDon't
Word the label so ticked means yes ("Send reminders").Use negatives ("Don't send reminders").
Use one checkbox per question.Use two checkboxes for "Yes" and "No": that's a RadioGroup.

Released under the PolyForm Noncommercial License 1.0.0.