Skip to the content

Checkbox

Checkbox is a native <input type="checkbox"> with a styled box, wrapped in a <label> so the text toggles it too. Each checkbox controls its own boolean; several can be on at once.
Forms

When to use

Use when
  • Accepting terms or setting independent preferences in a form submitted later.
  • Picking zero, one or several items of a short list.
Avoid when
  • Only one option of a set may be chosen — use Radio.
  • The setting takes effect immediately — use Switch.
  • You render several from data — use FieldGroup.

Usage

<Checkbox name="terms" label="I accept the terms" checked={accepted} onChange={(e) => setAccepted(e.target.checked)} />
<Checkbox name="news" label="Send me news" defaultChecked />
<Checkbox name="locked" label="Disabled" disabled />

Color and states

<Checkbox name="filter" label="Only favorites" color="information" />
<Checkbox name="consent" label="Consent" variant="error" />

The checked fill uses color (default primary). A validation variant (success, error) wins over color. indeterminate shows the mixed state of a partly selected parent. The prop is the source of truth: a click fires onChange, and the box stays mixed until you set indeterminate={false}.

Label

A string label renders as small text in ink.primary; labelProps overrides its typography. A ReactNode label (a link, bold text) renders as-is and ignores labelProps.

<Checkbox name="terms" label="I have read the terms" labelProps={{ fontSize: 'micro', color: 'ink.secondary' }} />

Accessibility

  • The native input takes focus with Tab and toggles with Space.
  • Keyboard focus draws a :focus-visible outline on the box, kept in forced-colors mode.
  • A checkbox with no visible label needs an aria-label.
  • indeterminate is announced as mixed.

Properties

Placement props (area, alignSelf, justifySelf) apply to the label wrapper.

See also