About
A pill-shaped toggle control for turning a setting on or off that takes effect immediately, with regular and small sizes.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Switch to your project and fits it to your theme.
Code
How Switch is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import Switch from "@/components/ui/switch";
export default function SwitchDemo() {
const [on, setOn] = React.useState(true);
return (
<div className="flex items-center gap-28">
<Switch aria-label="Regular" checked={on} onCheckedChange={setOn} />
<Switch aria-label="Small" size="small" defaultChecked />
<Switch aria-label="Disabled" disabled defaultChecked />
</div>
);
}








