A bare checkbox control (built on Radix's `Checkbox`) — the Radix checkbox button is this component's own root element. It has no built-in label/hint/error; wrap it in `FormField` for that chrome.

pnpm add @behivetech/atoms.checkbox

You are viewing Checkbox v0.5.0, snapshotted 2026-11-09. The latest is v0.5.2. Go to the latest →

A bare checkbox control (built on Radix's Checkbox) — the Radix checkbox button is this component's own root element. It has no built-in label/hint/error; wrap it in FormField for that chrome.

Usage

1import { Checkbox } from '@behivetech/atoms.checkbox';
2import { FormField } from '@behivetech/forms.form-field';
3
4const [checked, setChecked] = useState(false);
5
6<Checkbox checked={checked} onCheckedChange={setChecked} />
7
8<FormField label="Accept terms" htmlFor="terms" required>
9 <Checkbox id="terms" required checked={checked} onCheckedChange={setChecked} />
10</FormField>

Pass invalid (adds the --invalid modifier and sets aria-invalid) to visually mark the checkbox as invalid (pair with FormField's error prop for the message).

Properties

Checkbox props

PropTypeDefaultDescription
asChildboolean——
classNamestring—Additional class names to merge with the component root element
invalidbooleanfalseMarks the field as invalid: adds the `--invalid` modifier and sets `aria-invalid="true"`

Also accepts the native attributes of its root element (className, aria-*, event handlers, …).