Switch

Installation

$npx shadcn-macos@latest add switch

Examples

Wi-Fi Enabled

Props

<Switch />
PropTypeDefaultDescription
checkedboolean—Controlled boolean toggle state.
defaultCheckedbooleanfalseInitial toggle state when uncontrolled.
onCheckedChange(checked: boolean) => void—Event handler fired when the switch toggle state changes.
disabledbooleanfalseWhether the switch cannot be toggled.
classNamestring—Custom styling classes.