Skip to content
esc

Checkbox

Inputshadcn/ui

Turns an option on or off, alone ('Remember me') or in a list of independent options.

When to use

  • Put the label on the right and make it clickable: <Label htmlFor> around the text.
  • Use indeterminate on a 'Select all' row when only some are checked.
  • Don't use a Checkbox for a setting that applies at once; use Switch.
  • Don't use it to pick one of several options; use RadioGroup.

Accessibility

Role
checkbox
Keyboard
Space toggles. Tab moves focus.
Notes
Always pair it with a visible label linked by htmlFor and id.

Props

  • checked / onCheckedChange

    boolean | 'indeterminate' / (checked) => void

    Controlled state; 'indeterminate' shows a dash for a partly selected group.

  • aria-invalid

    boolean

    Red border, e.g. terms not accepted.

Prompt for your agent

Use the UnbuiltUI Checkbox. Call unbuilt_get_component("Checkbox") first and follow its spec: variants, states, usage rules and accessibility.

unbuilt_get_component returns

0 variants6 states2 props4 usage rules3 a11y notes7 tokens1 example

Add it with shadcn

$npx shadcn add https://unbuiltui.com/r/checkbox.json

Tokens · 7

bg.raisedbg.inversefg.inversefg.mutedborder.defaultborder.focusdanger.default