Checkbox
Checkboxes let users select one or more independent options, or toggle a single boolean setting with a square control and optional label.
Overview
catnip-checkbox is a form-associated custom element for one option (box + label text in the default slot), with optional supporting text below the row for errors or hints. The visible box matches the Figma checkbox spec (sizes m / l, checked, indeterminate, disabled, read-only, and danger validation). For a labelled group with shared supporting copy, use Checklist. Multi-select dropdown rows reuse the same internal checkbox chrome. Shared field patterns are summarised on Inputs overview.
Live example
Guidelines
When to use
| Control | Use for |
|---|---|
Checkbox (catnip-checkbox) | A single option: consent line, standalone boolean, or one row with its own error message. |
Checklist (catnip-checklist) | Multiple related options with a field label, options + modelValue, and group-level supporting text. |
| Toggle | A single on/off setting where the metaphor is “enable/disable”. |
| Radio (future) | Exactly one choice from a small set. |
Option row
catnip-checkbox exposes option label text in the default slot (or aria-label when the slot is empty). It does not include a field label or group legend — use catnip-checklist for that.
Optional supporting-text renders below the checkbox row (not inside the clickable label), for per-option hints or validation — matching Figma Checkbox input with an info message.
Indeterminate
Set .indeterminate="true" on the host when a parent represents a partial selection (e.g. some but not all child rows checked). Clear indeterminate when the user selects all or none.
Interaction states
- Interactive unchecked boxes are transparent, allowing the surrounding surface to show through.
- Checked and indeterminate boxes use one uninterrupted semantic background colour with component-specific check and dash marks.
- Disabled and read-only styles take precedence over
intent="danger", including checked and indeterminate states. - Danger hover styling applies only to interactive options and uses the dedicated danger hover border/background tokens.
- Disabled and read-only unchecked boxes use the disabled subtler background token.
Validation
- Single checkbox: set
intent="danger"andsupporting-texton the host; the input setsaria-invalid. - Checkbox groups: put the group label and field-level
supporting-textoncatnip-checklist. SetintentandsupportingTexton the matchingoptionsrow when one option is invalid.
Dropdown lists
Multi-select catnip-dropdown rows use the same checkbox chrome internally — do not render catnip-checkbox inside list options.