Checkbox

A 16pt rounded checkbox that fills with the accent color, with mixed state support.

@cupertinoui/checkboxBase UI Checkbox Registry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/checkbox

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"

<Label>
  <Checkbox /> Open at login
</Label>

Examples

States

Off, on, mixed and disabled. In an inactive window a checked box turns grey.

Mixed state

A parent checkbox shows the mixed state when only some of its children are on.

API Reference

Every part forwards the props of the underlying Base UI Checkbox part. The props below are the ones CupertinoUI adds or changes.

Checkbox

PropTypeDescription
checkedbooleanThe controlled state. Use defaultChecked for an uncontrolled checkbox.
indeterminateboolean
Default: false
Shows the mixed state, e.g. for a parent of checkboxes where only some are on.
onCheckedChange(checked: boolean) => voidCalled when the state changes.
disabledbooleanPrevents interaction.
classNamestringExtra classes, merged with the component's own.