serayudigital

Theme Toggle

Buttons

About

A button that cycles through light, dark, and system theme preferences and shows a sun, moon, or monitor icon for the active mode.

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

Code

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

Usage.tsx

import { ThemeToggle } from "@/components/ui/theme-toggle";

export default function ThemeToggleDemo() {
  return (
    <div className="flex min-h-[240px] w-full items-center justify-center bg-background p-10 text-foreground">
      <div className="flex flex-col items-center gap-4 rounded-lg border border-border bg-card p-8">
        <p className="text-sm text-muted-foreground">
          Click to cycle light / dark / system
        </p>
        <ThemeToggle ariaLabel="Toggle theme" />
      </div>
    </div>
  );
}

Dependencies

More by serayudigital

View all
  • Date Picker

    Date Picker

    10
  • Mobile Search

    Mobile Search

  • Data Table

    Data Table

  • Chat Bubble

    Chat Bubble

More in Buttons

View all
  • App Store Button

    App Store Button

    471
  • Texture Button

    Texture Button

    101
  • Button

    Button

    14
  • Button

    Button

    8
  • Button

    Button

    75
  • Button Group

    Button Group

  • Button

    Button

    66
  • Native Button

    Native Button

    7