Realistic Switch
Realistic Switch: Latching physical push switch that sinks into a recessed socket, stays down with an internal glow, and pops up. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.
Install Realistic Switch
npx motion-ui-skill add realistic-switchComponents install as source into your project. The interactive page also includes preview, code, documentation and install tabs.
Dependencies
clsxmotionreacttailwind-merge
Source files
Realistic Switch
Latching physical push switch that sinks into a recessed socket, stays down with an internal glow, and pops up.
Install
npx motion-ui-skill add realistic-switch
Dependencies
clsxmotionreacttailwind-merge
Usage
"use client";
import { RealisticSwitch } from "@/components/buttons/realistic-switch";
export function RealisticSwitchDemo() {
return (
<div className="flex items-center justify-center p-6">
<RealisticSwitch>Click Me</RealisticSwitch>
</div>
);
}
API Reference
RealisticSwitch
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
checked |
boolean |
false | No | Controlled switch state |
onCheckedChange |
(checked: boolean) => void |
— | No | State change handler |
className |
string |
— | No | Additional CSS classes |