Skip to content

Components · Forms

Checkbox

Binary or indeterminate choice with inline label.

@rookcom/monarch-reactComponent

Inline label and indeterminate

About once a month.

Usage examples

The example at the top of the page is the only one for this component.

Purpose

A binary (or indeterminate) choice, with an optional inline label and description. Built on Radix Checkbox.

Use when

  • The choice is submitted with a form, or several independent options can be on at once.
  • A "select all" control that is partly selected (checked="indeterminate").

Avoid when

  • The setting applies immediately: use Switch.

Design principles

  • Pass label for an inline label; omit it when the checkbox sits in a Field with a FieldLabel.
  • Participates in native forms through name and value.

API reference

import { Checkbox } from '@rookcom/monarch-react';
ExportKindRenderingRoot class
Checkboxcomponentclient.mn-checkbox-

Forwards its ref to the Radix Checkbox root (a <button role="checkbox">).

With label, className goes on the .mn-choice wrapper; without it, on the checkbox.

Generated from the TypeScript declarations of packages/react/src/components/forms/checkbox.

Properties

Checkbox

A checkbox with optional inline label. Supports `checked="indeterminate"`. Space toggles it; it participates in native forms via `name`/`value`.

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
descriptionReactNodeSecondary text under an inline label.
disabledboolean
idstring
invalidboolean
labelReactNodeInline label. Omit when the checkbox sits inside a Field with a FieldLabel.

Variants

Checkbox has a single size and style; it has no variant props.

States

StateExposed asBehaviour
Checked / indeterminatedata-state='checked' | 'indeterminate'Filled accent box with a check or a dash glyph.
Invalidaria-invalid="true"Danger border; from invalid or the surrounding Field.
DisableddisabledDimmed; the inline label uses the disabled text colour.
Focus–Visible focus ring on :focus-visible.

Interaction behaviour

  • Click on the box or the inline label toggles it.
  • description renders under the label and is added to aria-describedby.

Keyboard support

KeysAction
TabMoves focus to the checkbox.
SpaceToggles the checkbox.

Accessibility

Role
checkbox
Accessible name
The inline label (a <label htmlFor>), a FieldLabel, or aria-label.
  • Indeterminate is exposed as aria-checked="mixed".
  • The description is linked with aria-describedby.

Responsive behaviour

This section is incomplete

No responsive behaviour is defined; the inline label wraps with its container.

Theme support

  • Colours are semantic tokens; the checked fill follows the product accent.

Do and don't

Do

  • Write the label as the positive statement ("Email me updates").

Don't

  • Do not use a checkbox for a setting that saves immediately; use Switch.
  • Switch: On/off settings that apply immediately.
  • Field: Label and error wiring for a checkbox without an inline label.
  • DataTable: TableSelectCell uses Checkbox for row selection.

Dependencies

KindDepends on
npm packages@radix-ui/react-checkboxreact
Monarch componentsField

Testing coverage

  • Toggles with Space and click, including a click on the inline label, and is described by its description.
  • Supports indeterminate (aria-checked="mixed").
CheckCovered
Axe in jsdomYes
Server renderingYes
Browser suitesVisual baselines: /__gallery

Tests: packages/react/src/components/forms/checkbox