jdavisson87

Switch

Component

About

An accessible on/off toggle switch built on React Aria with a sharp, squared track-and-thumb design for settings and preference panels.

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 flex-col gap-4">
      <Switch defaultSelected>Email notifications</Switch>
      <Switch>Push notifications</Switch>
      <Switch isDisabled>Weekly digest (managed by your admin)</Switch>
    </div>
  );
}

Dependencies

More by jdavisson87

View all
  • Text Field

    Text Field

  • Status Badge

    Status Badge