kuratlielia

Switch

Component

About

A tactile toggle switch for settings that take effect immediately, with a spring-animated thumb that stretches like a held finger while pressed.

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

import * as React from "react";
import { Switch } from "@/components/ui/switch";

export default function SwitchDemo() {
  const [checked, setChecked] = React.useState(false);

  return (
    <div className="flex min-h-[200px] w-full items-center justify-center bg-[var(--background)] text-[var(--foreground)]">
      <Switch
        label="Enable notifications"
        checked={checked}
        onCheckedChange={setChecked}
      />
    </div>
  );
}

Dependencies

More by kuratlielia

View all
  • Activity Heatmap

    Activity Heatmap

    342
  • Image Compare

    Image Compare

    105
  • User Menu

    User Menu

    93
  • Date Range Picker

    Date Range Picker

    62
  • Stats Band

    Stats Band

    52
  • Usage Meter

    Usage Meter

    45
  • Signature Pad

    Signature Pad

    37
  • Timeline

    Timeline

    34