Switch

Inputs & Controls

macOS toggle switch with smooth pill sliding animation.

Installation

$npx shadcn-macos@latest add switch

Examples

Wi-Fi Enabled

Props

<Switch />
PropTypeDefaultDescription
checkedbooleanControlled boolean toggle state.
defaultCheckedbooleanfalseInitial toggle state when uncontrolled.
onCheckedChange(checked: boolean) => voidEvent handler fired when the switch toggle state changes.
disabledbooleanfalseWhether the switch cannot be toggled.
classNamestringCustom styling classes.