Checkbox

Checked, unchecked, and indeterminate states.

Installation

npx @noarka/cli add checkbox

Usage

tsx
import { Checkbox } from "@noarka/ui";
tsx
<label className="flex cursor-pointer items-center gap-2 text-sm">  <Checkbox defaultChecked /> Email notifications</label>

Examples

Form integration

Name, value and required wire the checkbox into native form submission and validation.

Disabled

Disabled checkboxes ignore interaction and render dimmed.

With description

Pair the label with helper text for longer explanations.

API reference

Checkbox

PropTypeDefault
checked

Controlled checked state. Use with onCheckedChange.

boolean-
defaultChecked

Initially checked when uncontrolled.

booleanfalse
onCheckedChange

Called when the checkbox is ticked or unticked.

(checked: boolean) => void-
disabled

Ignore user interaction. Renders at half opacity.

booleanfalse
indeterminate

Mixed state: neither ticked nor unticked. Pair with checked={false}.

booleanfalse
readOnly

Show state without allowing tick or untick.

booleanfalse
required

Require the checkbox to be ticked before form submit.

booleanfalse
name

Identifies the field when the form is submitted.

string-
value

Value submitted with the form when ticked.

string-
render

Polymorphic render prop. Use to render a custom element.

ReactElement | ((props) => ReactNode)-
className

Additional classes merged with the default checkbox styles.

string-