Skip to main content

Switch

An animated switch with seven tactile motion variants.

variant="icon-morph"·ON
iOS Stretch
Rotate
Jelly
Icon Morph
Liquid Fill
3D Flip
Core Shrink

Customize

SizeMedium
Speed multiplier1

Installation

Add the component with the registry command:

npx shadcn@latest add @kinetic/switch

Usage

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.

PropTypeDefaultDescription
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.
speednumber1Animation speed multiplier (higher is faster; maps to CSS duration scale).
checkedboolean-Controlled checked state.
defaultCheckedbooleanfalseInitial checked state when uncontrolled.
onCheckedChange(checked: boolean) => void-Callback fired when the switch toggles.
disabledbooleanfalseDisables pointer and keyboard interaction.
onLabel / offLabelstring"ON" / "OFF"Front and back face labels used by the flip-3d variant.

Notes

Always associate Switch with a FieldLabel or Label via matching id and htmlFor, or supply aria-label when rendered standalone.