darshan-rajadhyaksha

Switch

Forms 4

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 SwitchDemo() {
  return (
    <div className="flex items-center gap-2">
      <Switch id="notifications" />
      <label htmlFor="notifications">Enable notifications</label>
    </div>
  );
}

Dependencies

More by darshan-rajadhyaksha

View all
  • Backdrop

    Backdrop

    3
  • Accessible Dialog

    Accessible Dialog

    2
  • Input

    Input

    2
  • Divider

    Divider

  • Avatar

    Avatar

  • Chip

    Chip

  • Progress Bar

    Progress Bar

  • Card Content

    Card Content

More in Forms

View all
  • Premium Auth

    Premium Auth

    593
  • Contact Form

    Contact Form

    28
  • Form

    Form

    4
  • Login 1

    Login 1

    70
  • Book A Demo 1

    Book A Demo 1

    94
  • Contact Card

    Contact Card

    1.1K
  • HeroUI Field Error

    HeroUI Field Error

    13
  • Form [react-aria-components]

    Form [react-aria-components]

    19