Checkbox

A control that allows the user to toggle between checked, unchecked and indeterminate states.

$bunx shadcn@latest add @nx-ui/checkbox
Registry item

Basic

Pair a Checkbox with a Label using a matching id. Clicking the label toggles the control.

Controlled & indeterminate

Drive `checked` yourself for a controlled checkbox, or set `indeterminate` for a parent covering a mixed selection of children.

States

Disabled dims and blocks interaction; aria-invalid draws the destructive ring for validation errors.

Disabled with a reason

When a checkbox is locked, keep the row readable and say why — pair the disabled control with a FieldDescription carrying the reason.

Error state

aria-invalid draws the destructive ring, and a FieldError explains what is missing. Tick the box to clear the error.

API reference

Exported parts and their props, extracted from the component source.

…extends CheckboxPrimitive.Root.Props