prebuiltui

Toggle Switch

Forms 2

About

Here is Toggle Switch component

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Toggle Switch to your project and fits it to your theme.

Code

How Toggle Switch is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

export default function Example() {
    return (
        <div className="flex flex-wrap items-center justify-center gap-12">
            <label className="relative inline-flex items-center cursor-pointer text-gray-900 gap-3">
                <input type="checkbox" className="sr-only peer" />
                <div className="w-12 h-7 bg-slate-300 rounded-full peer peer-checked:bg-indigo-600 transition-colors duration-200"></div>
                <span className="dot absolute left-1 top-1 w-5 h-5 bg-white rounded-full transition-transform duration-200 ease-in-out peer-checked:translate-x-5"></span>
                Enable Feature
            </label>
            <label className="relative inline-flex items-center cursor-pointer text-gray-900 gap-3">
                <input type="checkbox" className="sr-only peer" checked />
                <div className="w-12 h-7 bg-slate-300 rounded-full peer peer-checked:bg-indigo-600 transition-colors duration-200"></div>
                <span className="dot absolute left-1 top-1 w-5 h-5 bg-white rounded-full transition-transform duration-200 ease-in-out peer-checked:translate-x-5"></span>
                Feature Enabled
            </label>
        </div>
    );
};

More by prebuiltui

View all
  • Image Gallery

    Image Gallery

    1.5K
  • Hero Section

    Hero Section

    452
  • Feature Sections

    Feature Sections

    382
  • Testimonial

    Testimonial

    356
  • Cards

    Cards

    244
  • FAQ Sections

    FAQ Sections

    193
  • Form

    Form

    144
  • Login Form

    Login Form

    141

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