Skip to content

Inputs

Checkbox

A native checkbox with a crisp custom box, for independent on/off choices and multi-select lists. It supports checked, unchecked and indeterminate, an optional label and description, and a group wrapper that labels a set of options together.

On this page

Usage

components/ui/checkbox.tsx
import { Checkbox } from "@/components/ui/checkbox"; export function Example() {  return <Checkbox label="Send a copy to my email" defaultChecked />;}

Examples

Select all

The parent box turns indeterminate when only some children are checked. Clicking it checks or clears them all.

States

With description

Group

CheckboxGroup renders a fieldset and legend, so the question is read before each option.

Export columns

Included in the CSV download.

Payment methods

Choose at least one method.

Horizontal

Working days

Props

Checkbox

  • labelReactNodedefault: —Visible label. Without it, pass aria-label.
  • descriptionReactNodedefault: —Second line under the label (aria-describedby).
  • indeterminatebooleandefault: falseMixed state; announced as “mixed” by screen readers.
  • checked / defaultCheckedbooleandefault: —Controlled or initial state.
  • onChange(e: ChangeEvent) => voiddefault: —Native change event; read e.target.checked.
  • invalidbooleandefault: —Red border and aria-invalid.
  • ...propsInputHTMLAttributesdefault: —name, value, disabled, required and other native attributes.

CheckboxGroup

  • labelrequiredReactNodedefault: —Legend for the set.
  • descriptionReactNodedefault: —Help text under the legend.
  • errorReactNodedefault: —Error message under the options.
  • orientation"vertical" | "horizontal"default: "vertical"Stack or wrap the options.

Accessibility

  • A native <input type="checkbox">: Space toggles it, and it takes part in forms with name and value.
  • The whole label row is clickable; the box itself is only 16px, the target is the full row.
  • indeterminate sets the DOM property, which screen readers announce as “mixed”.
  • CheckboxGroup is a <fieldset> with a <legend>, so the group question is announced when focus enters it.
  • Checked state is shown by the check mark, not only the fill color, so it reads in every accent and in high contrast mode.

Suggested