Checkbox
A control that allows the user to toggle between checked, unchecked and indeterminate states.
bunx shadcn@latest add @nx-ui/checkboxBasic
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.
Composition: haulage consent checklist
Checkboxes inside Field/FieldLabel rows styled as selectable cards — rounded, padded and brand-tinted while checked — used as a required-consent checklist before dispatching a waste movement.
API reference
Exported parts and their props, extracted from the component source.
…extends CheckboxPrimitive.Root.Props