Mahmoud Ilyan

Switch

Component

About

A toggle control for switching between two mutually exclusive states like on/off or enabled/disabled, built on Radix UI's switch primitive.

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 { Label } from "@/components/ui/label";

export default function SwitchDisabledDemo() {
  return (
    <div className="flex items-center gap-2">
      <Switch disabled checked />
      <Label className="font-normal text-ink-light">Feature locked</Label>
    </div>
  );
}

Dependencies

More by Mahmoud Ilyan

View all
  • Radio Card

    Radio Card

  • Segmented Control

    Segmented Control

  • Checkbox

    Checkbox

  • Avatar

    Avatar