azabroflovski

Switch

Forms 1

About

An on/off toggle switch for a settings row, with the label on the left and the switch on the right; ported to React from the Vue-based Oyna UI library by azabroflovski (MIT licensed).

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";
import { useState } from "react";

export default function SwitchDemo() {
  const [email, setEmail] = useState(true);
  const [push, setPush] = useState(false);

  return (
    <div
      className="flex flex-col gap-4 rounded-lg p-6"
      style={{ background: "#0b0b0f", color: "#fff" }}
    >
      <Switch checked={email} onCheckedChange={setEmail}>
        Email notifications
      </Switch>
      <Switch checked={push} onCheckedChange={setPush}>
        Push notifications
      </Switch>
      <Switch disabled>Disabled</Switch>
    </div>
  );
}

More by azabroflovski

View all
  • Select

    Select

    2
  • Dialog

    Dialog

    2
  • Checkbox

    Checkbox

    2
  • Card

    Card

  • Bar Chart

    Bar Chart

More in Forms

View all
  • Premium Auth

    Premium Auth

    524
  • Contact Card

    Contact Card

    1K
  • Book A Demo 1

    Book A Demo 1

    73
  • Login 1

    Login 1

    53
  • Form

    Form

    137
  • Card Studio

    Card Studio

    41
  • Modern & Stunning sign in

    Modern & Stunning sign in

    1.6K
  • SignInPage

    SignInPage

    668