Checkbox
Toggle checkbox input
UI PrimitiveForm Inputs
Overview
Built on Radix UI's Checkbox primitive. Supports checked, unchecked, and indeterminate states. When children are provided, wraps the checkbox and label in a flex row.
Usage
import { Checkbox } from "@leanicon/web-builder-library";Standalone:
With inline label:
Controlled usage
const [checked, setChecked] = React.useState(false);
<Checkbox id="accept" checked={checked} onCheckedChange={(value) => setChecked(value === true)}>
I accept the terms
</Checkbox>;Notes
- Accepts all Radix
Checkbox.Rootprops (checked,defaultChecked,onCheckedChange,disabled,required,name,value). - The indeterminate state displays a minus icon; checked state displays a check icon.
- Use
aria-invalidto trigger the error ring style. - Dark mode is handled via semantic tokens.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
asChild | boolean | — | No |