Checkbox

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

radix-ui.com

Default

Default (no label)

<Checkbox id="default-checkbox" />

Variants

Default

<div className="flex items-center space-x-2">
  <Checkbox id="basic-checkbox" checked={false} onCheckedChange={() => {}} />
  <label htmlFor="basic-checkbox" className="text-sand-12 text-sm">
    Accept terms
  </label>
</div>

Disabled

<div className="flex items-center space-x-2">
  <Checkbox id="disabled-checkbox" disabled={true} />
  <label htmlFor="disabled-checkbox" className="text-sand-11 text-sm">
    Disabled option
  </label>
</div>

Indeterminate

<div className="flex items-center space-x-2">
  <Checkbox id="indeterminate-checkbox" checked="indeterminate" onCheckedChange={() => {}} />
  <label htmlFor="indeterminate-checkbox" className="text-sand-12 text-sm">
    Click to toggle state
  </label>
</div>

Danger

<div className="flex items-center space-x-2">
  <DangerCheckbox id="danger-checkbox" />
  <label htmlFor="danger-checkbox" className="text-sand-12 text-sm">
    Danger checkbox
  </label>
</div>