Checkbox

A styled checkbox input built on Base UI's headless Checkbox primitive, rendering a checkmark indicator with focus, disabled, and validation states.

Default

Terms accepted: No

Checkbox Group

User permissions

Active: read, write

Disabled

Disabled states

Indeterminate

Selected: Apples

Readonly

Read-only states

Read-only checkboxes display state but cannot be toggled by the user.

With Label

Using Label component

Installation

npx shadcn@latest add @byronwade/checkbox

Props

PropTypeDefaultDescription
checkedbooleanControlled checked state of the checkbox.
defaultCheckedbooleanfalseInitial checked state for uncontrolled usage.
onCheckedChange(checked: boolean, eventDetails: CheckboxRootChangeEventDetails) => voidCallback fired when the checkbox is ticked or unticked.
disabledbooleanfalsePrevents user interaction and applies disabled styling.
readOnlybooleanfalsePrevents the user from ticking or unticking the checkbox.
requiredbooleanfalseMarks the checkbox as required for form submission.
indeterminatebooleanfalsePuts the checkbox in a mixed state, neither checked nor unchecked.
namestringField name submitted with the form.
valuestringValue submitted with the form when the checkbox is checked.
classNamestringAdditional CSS classes merged onto the root element.