kuratlielia

Split Theme Switch

Buttons 2

About

A toggle button that switches a page between light and dark theme with an animated sun/moon icon swap.

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

Code

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

Usage.tsx

"use client";

import ThemeSwitch, { type Theme } from "@/components/ui/theme-switch-split";
import { useState } from "react";

export default function ThemeSwitchSplitDemo() {
  const [theme, setTheme] = useState<Theme>("light");

  return (
    <div
      className="flex w-full h-screen items-center justify-center"
      style={{ background: "var(--background)", color: "var(--foreground)" }}
      data-theme={theme}
    >
      <ThemeSwitch
        theme={theme}
        variant="split"
        onThemeChange={(next) => setTheme(next)}
      />
    </div>
  );
}

Dependencies

More by kuratlielia

View all
  • Activity Heatmap

    Activity Heatmap

    516
  • Image Compare

    Image Compare

    199
  • Stats Band

    Stats Band

    150
  • User Menu

    User Menu

    114
  • Date Range Picker

    Date Range Picker

    100
  • Usage Meter

    Usage Meter

    79
  • Ridgeline Chart

    Ridgeline Chart

    63
  • Timeline

    Timeline

    59

More in Buttons

View all
  • Button

    Button

    20
  • Button

    Button

    3
  • Button Group

    Button Group

    18
  • Button

    Button

    149
  • Icon Label Subtext Button

    Icon Label Subtext Button

    69
  • Button

    Button

    9
  • Button

    Button

    37
  • Texture Button

    Texture Button

    113