zweiundeins

Theme Switch

Buttons

About

A cookie-backed light/dark/auto theme picker with segmented, select or icon-menu variants, that sets a data attribute on the html element and syncs across every switch on the page.

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

Code

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

Usage.tsx

import ThemeSwitch from "@/components/ui/theme-switch";

export default function ThemeSwitchMenuDemo() {
  return (
    <div className="flex min-h-[200px] w-full items-center justify-center bg-background p-10">
      <ThemeSwitch
        variant="menu"
        cookie="sb-theme-demo3"
        attribute="data-demo-theme"
        themes={["auto", "deep-space", "nebula", "daylight"]}
      />
    </div>
  );
}

More by zweiundeins

View all
  • Busy

    Busy

    7
  • Odometer

    Odometer

  • Meter

    Meter

  • Radio Group

    Radio Group

  • Gauge

    Gauge

  • Checkbox Group

    Checkbox Group

  • QR Code

    QR Code

  • Alert

    Alert

More in Buttons

View all
  • Button

    Button

    14
  • Button

    Button

    34
  • Texture Button

    Texture Button

    92
  • Button Save

    Button Save

    46
  • Button

    Button

    64
  • Button Group

    Button Group

    3
  • App Store Button

    App Store Button

    454
  • Notification Button

    Notification Button

    103