Components
Loading preview...
A fluid animated switch with draggable thumb, smooth pill morphing on hover/press, and accessible keyboard support.
@micka_design
npx shadcn@latest add https://21st.dev/r/micka_design/switch"use client";
import { useState } from "react";
import { Switch } from "../components/ui/switch";
export default function SwitchGroupDemo() {
const [states, setStates] = useState({ notifications: true, emails: false, sounds: true, analytics: false });
const toggle = (key: keyof typeof states) => setStates(s => ({ ...s, [key]: !s[key] }));
return (
<div className="flex items-center justify-center min-h-screen bg-background">
<div className="transform scale-150 flex flex-col">
<Switch label="Notifications" checked={states.notifications} onToggle={() => toggle("notifications")} />
<Switch label="Emails" checked={states.emails} onToggle={() => toggle("emails")} />
<Switch label="Sounds" checked={states.sounds} onToggle={() => toggle("sounds")} />
<Switch label="Analytics" checked={states.analytics} onToggle={() => toggle("analytics")} />
</div>
</div>
);
}