Checkbox

A toggle for boolean values. Built on Radix Checkbox.

Import

import { Checkbox } from '@aspect/react';

With label

<Checkbox label="I agree to the terms" />

Controlled

const [checked, setChecked] = useState(false);
<Checkbox checked={checked} onCheckedChange={setChecked} label="Notify me" />;

Props

| Prop | Type | Default | Description | | ----------------- | ---------------------------- | ------- | --------------------------------- | | label | string | — | Auto-renders with a label element | | checked | boolean | — | Controlled state | | defaultChecked | boolean | — | Uncontrolled initial state | | onCheckedChange | (checked: boolean) => void | — | Change handler | | disabled | boolean | false | Disables the checkbox |

Accessibility