About
A toggleable on/off switch control for settings and preferences rows, with a label, an aria-switch role, and a spring-eased thumb animation.
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 SwitchToggle from "@/components/ui/switch";
import { Stack } from "@/components/ui/switch-utils/shared";
import { useState } from "react";
export default function SwitchStatesDemo() {
const [refunds, setRefunds] = useState(false);
const [drafts, setDrafts] = useState(true);
return (
<Stack gap={12}>
<SwitchToggle
checked={refunds}
onChange={setRefunds}
label="Issue refunds without approval"
/>
<SwitchToggle
checked={drafts}
onChange={setDrafts}
label="Draft replies in Intercom"
/>
</Stack>
);
}
















