Skip to content

Checkbox

A 16px checkbox on Base UI with a 24px hit area.

With a label

With a description

In a group

Notify me when

Disabled

Invalid

Installation

npx shadcn@latest add @khaeli/checkbox

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

Registry items
npm packages
  • @base-ui/react ^1.7.0
  • @keyline-icons/react ^2.2.0

Keyboard

Space
Ticks and clears the checkbox. Enter does nothing.
Tab
Moves focus to the checkbox. A disabled checkbox leaves the tab order.

Accessible name

  • It renders an element with role="checkbox" and aria-checked. Name it with a @khaeli/label whose htmlFor is the checkbox's id, or wrap both in the label.
  • Name a set of checkboxes as a group: FieldSet with a FieldLegend from @khaeli/field.
  • A description or an error is tied to the checkbox with aria-describedby. An unmet required checkbox carries aria-invalid.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/checkbox.json