Installation
npx shadcn@latest add @iconiq/r-switchProps
Switch
Binary on or off control with the same Iconiq thumb travel, squash response, and foreground fill sweep layered over Radix UI primitives.
checkedbooleandefaultCheckedbooleanonCheckedChange(checked: boolean) => voiddisabledbooleanlabelstringlabelSide"left" | "right"Default right
classNamestringAdditional Radix switch props such as aria-label, name, value, required, and form are forwarded to the root control.
If you provide label, the component keeps the same adjacent text button treatment as the core switch so the label still toggles the control.
Motion and interaction behavior
The switch uses separate motion values for thumb travel, thumb squash, and track fill opacity so the state change feels tactile without becoming noisy.
Built on Radix switch root and thumb primitives while preserving the same motion values for thumb travel, thumb squash, and track fill opacity as the core switch.
Pointer press slightly flattens the thumb before release, then the thumb snaps back with a softer bounce after the state change.
The dark foreground fill fades in as the thumb travels right, rather than swapping track color instantly.
Controlled and uncontrolled usage both keep the thumb animation synchronized with the underlying Radix state.
Registry bundle
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: @radix-ui/react-switch, motion.
Installs a Radix switch with the same checked, defaultChecked, label, and labelSide API as the Base UI version.
Uses Radix switch primitives under the exact same Iconiq track, thumb, and press-motion shell as the core switch component.
The generated registry file is /r/r-switch.json.