prebuiltui

Toggle Switch

Forms 4

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-16 h-8 bg-black rounded-full peer peer-checked:bg-slate-300 transition-colors duration-200"></div>
                <span className="dot absolute left-1 top-1 w-6 h-6 bg-white rounded-full transition-transform duration-200 ease-in-out peer-checked:translate-x-8"></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-16 h-8 bg-black rounded-full peer peer-checked:bg-slate-300 transition-colors duration-200"></div>
                <span className="dot absolute left-1 top-1 w-6 h-6 bg-white rounded-full transition-transform duration-200 ease-in-out peer-checked:translate-x-8"></span>
                Feature Enabled
            </label>
        </div>
    );
};

More by prebuiltui

View all
  • Image Gallery

    Image Gallery

    1.4K
  • Hero Section

    Hero Section

    447
  • Feature Sections

    Feature Sections

    375
  • Testimonial

    Testimonial

    348
  • Cards

    Cards

    242
  • FAQ Sections

    FAQ Sections

    191
  • Form

    Form

    141
  • Login Form

    Login Form

    138

More in Forms

View all
  • Premium Auth

    Premium Auth

    575
  • Login 1

    Login 1

    67
  • Contact Card

    Contact Card

    1.1K
  • Form

    Form

    19
  • Login Card

    Login Card

    35
  • Contact Form

    Contact Form

    28
  • Login Card

    Login Card

    31
  • Horizontal Form Fields

    Horizontal Form Fields

    8