Switch
An animated switch with seven tactile motion variants.
Customize
Installation
Add the component with the registry command:
npx shadcn@latest add @kinetic/switchUsage
Import the switch and render it as a form control:
import { Switch } from "@/components/kinetic/ui/switch";
export function Notifications() {
return <Switch aria-label="Notifications" />;
}Variants
Set variant to one of ios, rotate, jelly, icon-morph (default), liquid, flip-3d, or core.
<Switch variant="jelly" defaultChecked />
<Switch variant="liquid" />Sizes
Use size with sm, md, or lg.
<Switch size="sm" />
<Switch size="lg" />Controlled state
Pass checked with onCheckedChange to control the switch. The component also accepts standard input attributes such as disabled and name.
const [on, setOn] = useState(false);
<Switch checked={on} onCheckedChange={setOn} aria-label="Notifications" />Labels
The flip-3d variant shows text on its faces. Set onLabel and offLabel to customize it.
<Switch variant="flip-3d" onLabel="YES" offLabel="NO" />Motion preferences
Animations are skipped when reduced motion is enabled, either in the browser or in the Kinetic setting. Use the speed prop to scale animation timing.
API Reference
Switch
Accessible native checkbox-backed switch with 7 CSS-accelerated tactile animation variants and default iOS stretch physics.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "ios" | "rotate" | "jelly" | "icon-morph" | "liquid" | "flip-3d" | "core" | "icon-morph" | Selects the thumb and track animation style. |
size | "sm" | "md" | "lg" | "md" | Controls the proportional scale of the switch. |
speed | number | 1 | Animation speed multiplier (higher is faster; maps to CSS duration scale). |
checked | boolean | - | Controlled checked state. |
defaultChecked | boolean | false | Initial checked state when uncontrolled. |
onCheckedChange | (checked: boolean) => void | - | Callback fired when the switch toggles. |
disabled | boolean | false | Disables pointer and keyboard interaction. |
onLabel / offLabel | string | "ON" / "OFF" | Front and back face labels used by the flip-3d variant. |