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

    9
  • ECharts

    ECharts

    1
  • Count Up

    Count Up

    1
  • Sparkline

    Sparkline

  • Drawer

    Drawer

  • Starfield

    Starfield

  • Odometer

    Odometer

  • Meter

    Meter

More in Buttons

View all
  • Button

    Button

    5
  • Texture Button

    Texture Button

    97
  • Button Group

    Button Group

  • Eclipse Button

    Eclipse Button

    39
  • Button

    Button

    4
  • HeroUI Button Group

    HeroUI Button Group

  • Base Button

    Base Button

    4
  • App Store Button

    App Store Button

    458