Skip to content

Checkbox

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

Install

Bash
npx @madeui/cli add checkbox

Usage

TSX
import { Checkbox } from '@/components/ui/checkbox';

<label>
  <Checkbox defaultChecked /> Accept terms
</label>

Indeterminate

Description

Use Field with orientation="horizontal", FieldContent, and FieldDescription to pair a checkbox with helper text.

Receive occasional product updates and announcements.

Disabled

Invalid

Set invalid on Field to show validation errors — the label and error message pick up the invalid styling, and aria-invalid is applied to the checkbox automatically.

API reference

Built on Base UI Checkbox. The tables below cover the props this library adds or changes — every other prop is forwarded to the underlying Base UI part; see the Base UI Checkbox API reference for the full list.

Checkbox

PropTypeDefaultDescription
checkedboolean—Controlled checked state.
defaultCheckedbooleanfalse
onCheckedChange(checked: boolean) => void—
indeterminatebooleanfalse
disabledbooleanfalse
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

Was this page helpful?