darshan-rajadhyaksha

Switch

Forms

About

A themeable on/off toggle switch with semantic colors (default, success, warning, info, error), three sizes, controlled/uncontrolled state, and slot customization for the track and handle — ported to React from Darshan Rajadhyaksha's RockSolid SolidJS component library.

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 Switch from "@/components/ui/switch";

export default function SwitchDisabledDemo() {
  return (
    <div className="flex flex-col gap-4">
      <div className="flex items-center gap-2">
        <Switch id="disabled-off" disabled />
        <label htmlFor="disabled-off">Disabled</label>
      </div>
      <div className="flex items-center gap-2">
        <Switch id="disabled-on" disabled defaultChecked />
        <label htmlFor="disabled-on">Disabled and checked</label>
      </div>
    </div>
  );
}

Dependencies

More by darshan-rajadhyaksha

View all
  • Backdrop

    Backdrop

    2
  • Accessible Dialog

    Accessible Dialog

    1
  • Input

    Input

    1
  • Avatar

    Avatar

  • Chip

    Chip

  • Progress Bar

    Progress Bar

  • Card Content

    Card Content

  • Breadcrumbs

    Breadcrumbs

More in Forms

View all
  • Login 1

    Login 1

    64
  • Premium Auth

    Premium Auth

    571
  • Contact Card

    Contact Card

    1.1K
  • Form

    Form

    18
  • Book A Demo 1

    Book A Demo 1

    91
  • Authentication Card

    Authentication Card

    52
  • Card Studio

    Card Studio

    47
  • Login Card

    Login Card

    35