Zephora UI

Form

Switch

On/off toggle rendered as a native checkbox with role="switch", with an optional clickable label.

Import

import { Switch } from "@zephora/react";

Examples

Basic

Controlled

Sizes

API

Switch props

PropTypeDefaultDescription
checkedbooleanControlled checked state.
defaultCheckedbooleanfalseInitial checked state (uncontrolled).
onCheckedChange(checked: boolean) => voidCalled with the next checked state.
size"sm" | "md" | "lg""md"Control size.
childrenReactNodeOptional label content; the label wraps the control so it is clickable.
unstyledbooleanfalseHeadless mode — drops Zephora classes so your own CSS can style it.
…restInputHTMLAttributes<HTMLInputElement>Remaining native input props (name, disabled…) are forwarded.

Keyboard

KeyAction
SpaceToggles the switch.
TabMoves focus.