Checkbox

A control that allows the user to toggle between checked and unchecked.

Import

import { Checkbox } from '@matix/components/checkbox';

Usage

With Label

<Checkbox label="Email notifications" />
<Checkbox label="SMS notifications" />
<Checkbox label="Push notifications" defaultChecked />

Indeterminate

The indeterminate state represents a "mixed" selection — typically used in parent checkboxes that control a group.

Disabled

<Checkbox label="Disabled unchecked" disabled />
<Checkbox label="Disabled checked" disabled defaultChecked />

With Field

<Field label="Preferences" error={null}>
  <Checkbox label="I agree to the privacy policy" />
</Field>

Custom Styles

import * as stylex from '@stylexjs/stylex';

const custom = stylex.create({
  large: { transform: 'scale(1.25)' },
});

<Checkbox sx={custom.large} label="Larger checkbox" />;

API Reference

PropTypeDefaultDescription
labelReactNode—Label rendered next to the checkbox
defaultCheckedbooleanfalseInitial checked state (uncontrolled)
checkedboolean—Controlled checked state
onCheckedChange(checked: boolean, event: Event) => void—Called when checked state changes
indeterminatebooleanfalseShow indeterminate (mixed) state
disabledbooleanfalseDisable the checkbox
icons{ checked?: ReactNode; indeterminate?: ReactNode }—Replaces the built-in icons. See the Icons guide
sxStyleXStyles—StyleX style override

All other props are forwarded to the underlying Base UI Checkbox.

Accessibility

  • Wraps Base UI Checkbox — renders a native checkbox with proper ARIA attributes.
  • Indeterminate state sets aria-checked="mixed".
  • Focus ring via :focus-visible.
  • Label is associated automatically — clicking the label toggles the checkbox.

Keyboard

KeyAction
SpaceToggles the checkbox
TabMoves focus to / from the checkbox