Clinia UI

Checkbox

Turns one option on or off, or picks several from a list.

shadcn docs →

When to use

  • Turn one option on or off inside a form that's saved with a button.
  • Pick any number of options from a short list.

When not to use

  • Exactly one option from a list: use Radio Group.
  • A setting that applies as soon as it changes: use Switch.

Install

npx shadcn@latest add @clinia/checkbox

Anatomy

  1. 1Boxdata-slot="checkbox"border-input · data-checked:bg-primary
  2. 2Check markdata-slot="checkbox-indicator"size-3.5 · text-primary-foreground
  3. 3Labeldata-slot="label"text-sm · font-medium

Clinia rules

  • The resting box has an input border, which clears 3:1. Checked and indeterminate are a primary fill with a primary-foreground mark, never Trust.
  • Write the label as the positive statement that checking makes true: Share with the care team, not Don't share.
  • The hit area extends past the 16px box (after:-inset-x-3 after:-inset-y-2), so a click just outside the box still toggles it.

Do and don't

Do use checkboxes for options that don't exclude each other.
Don't use checkboxes for a choice of exactly one: use Radio Group.
Do label what checking makes true.
Don't use a negative label that reads as a double negative when unchecked.

States

unchecked
checked
indeterminate
focus
invalid
disabled
disabled · checked

Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.

Accessibility

Built in

  • Focus-visible shows a solid Trust ring (border-ring ring-3 ring-ring/30); aria-invalid swaps it to a destructive ring, but a checked box keeps its primary border even when invalid.
  • Base UI renders a role="checkbox" element with aria-checked, including mixed for indeterminate, plus a hidden native input so the value submits with the form.

Your responsibility

  • Pair every checkbox with a Label (htmlFor = the checkbox id), or give it an aria-label when a row already names it, as in a table.
  • Group related checkboxes in a FieldSet with a FieldLegend, so the question is read with each option.
  • Use indeterminate only on a parent that controls a list, when some but not all children are checked.

How to test

  1. Press Tab to reach the checkbox: the Trust ring appears.
  2. Press Space: it toggles. Enter does not toggle it.
  3. Click the label: it toggles too.
  4. With a screen reader, it's announced as its label, then checkbox, then checked, not checked or mixed.

API

Every prop comes from Base UI Checkbox.