Switch

The macOS 27 toggle with a pill-shaped knob, in mini, small, medium and large sizes.

Installation

pnpm dlx shadcn@latest add @cupertinoui/switch

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

Usage

import { Switch } from "@/components/ui/switch"

<Switch defaultChecked aria-label="Wi-Fi" />

Examples

Sizes

Mini (36×16), small (44×20), medium (54×24) and large (64×28). System Settings uses mini switches in its grouped forms.

API Reference

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

Switch

PropTypeDescription
size"mini" | "sm" | "default" | "lg"
Default: "default"
The control size.
checkedbooleanThe controlled state.
onCheckedChange(checked: boolean) => voidCalled when the switch is toggled.
classNamestringExtra classes, merged with the component's own.