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
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | — | Label rendered next to the checkbox |
defaultChecked | boolean | false | Initial checked state (uncontrolled) |
checked | boolean | — | Controlled checked state |
onCheckedChange | (checked: boolean, event: Event) => void | — | Called when checked state changes |
indeterminate | boolean | false | Show indeterminate (mixed) state |
disabled | boolean | false | Disable the checkbox |
icons | { checked?: ReactNode; indeterminate?: ReactNode } | — | Replaces the built-in icons. See the Icons guide |
sx | StyleXStyles | — | 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
| Key | Action |
|---|---|
Space | Toggles the checkbox |
Tab | Moves focus to / from the checkbox |