Checkbox

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

A checkbox component for boolean selections.

Default

Unchecked

Checked

Disabled

With Label

Default

Checked

Usage

import { Checkbox, Label } from "@delphi/ui";

export function Example() {
  return (
    <div className="flex items-center gap-2">
      <Checkbox id="agree" />
      <Label htmlFor="agree">I agree</Label>
    </div>
  );
}

API Reference

PropTypeDefaultDescription
checkedboolean-Controlled checked state
defaultCheckedbooleanfalseDefault checked state
onCheckedChange(checked: boolean) => void-Called when checked state changes
disabledbooleanfalseDisables the checkbox
idstring-HTML id for label association
Always pair checkboxes with labels using htmlFor and id
Use checkboxes for binary choices or multi-select options
Make the clickable area include both the checkbox and label
Group related checkboxes together with a fieldset and legend
Preserve checkbox state when validation errors occur
Use checkboxes for mutually exclusive options — use radio buttons instead
Pre-check options that require explicit consent (like terms)
Use negative phrasing like "Don't send me emails"
Hide required checkbox errors until form submission
ESC
No results found