docs / core / checkbox
Checkbox
the collecting control. it gathers choices and waits for a submit, ticking one commits nothing until you send the form. that deferral is the whole line between it and Switch.
intensity · recedesrsc · client
provenance
authored in usvalayer
core / primitivesintensity
recedes · safe anywhere, including dense surfacescomposition
forms, settings rows, filter groups. anywhere choices accumulateindeterminate heads a group whose children disagreenot for actions that apply immediately. that is a switch, not a checkboxnever unlabelled. the label is the click target and the accessible namea11y
role="checkbox" named by its label · disabled sets aria-disabled · the check icon is aria-hiddenjest-axedependencies
@base-ui/react · class-variance-authoritylive demo · try it out
You agree to our terms of service and privacy policy.
customize
labelthe click target and accessible name
descriptionhelper text under the control
sizesm for dense rows
defaultCheckedstarts ticked
indeterminatethe mixed state for a group head
disabledgreys out the whole field
usage
import { Checkbox } from "@usva-ui/react/primitives/checkbox";
<Checkbox
label="Accept terms"
description="You agree to our terms of service and privacy policy."
/>props
| prop | type | default | notes |
|---|---|---|---|
| checked | boolean | — | controlled checked state. |
| defaultChecked | boolean | false | initial checked state when uncontrolled. |
| onCheckedChange | (checked: boolean) => void | — | fires with the next checked state. |
| indeterminate | boolean | false | the mixed state, for a parent whose children disagree. |
| disabled | boolean | false | disables the whole field, label included. |
| label | ReactNode | — | the field label, wired to the control by id. |
| description | ReactNode | — | helper text under the control. |
| size | "sm" | "md" | "md" | sm for dense rows. the hidden hit area grows to compensate. |
get it
bun add @usva-ui/reactusage
import { Checkbox } from "@usva-ui/react/primitives/checkbox";
<Checkbox
label="Accept terms"
description="You agree to our terms of service."
/>