Arunachalam

Animated Theme Toggle Button

Buttons 50

About

A modern React component that lets users switch between light and dark color modes with a visually engaging animated transition. This button supports both horizontal and vertical reveal animations using the View Transitions API for ultra-smooth theme changes. The icon updates instantly to show the current mode (sun for light, moon for dark), and the UI state is synchronized across the app to reflect user preference. Built with accessibility and performance in mind, the component works seamlessly in any Tailwind CSS + Framer Motion project, and is easy to customize for diagonal or cross-line transitions. Features: Animated theme transitions (horizontal, vertical, extendable for more) Sun & moon icon with Framer Motion effects Accessible and focus-friendly Synchronizes with global theme state Easy to plug into any React/Next.js app Perfect for clean, user-friendly dark mode toggles in modern web apps.

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

Code

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

Usage.tsx

import { AnimatedThemeToggleButton } from "@/components/ui/animated-theme-toggle-button"

export default function ThemeTransitionDemo() {
  return (
    <div className="flex flex-col items-center justify-center min-h-screen gap-10 bg-background transition-colors">
      <div className="flex flex-col items-center">
        <AnimatedThemeToggleButton type="horizontal" />
        <span className="mt-2 text-xs">Horizontal Theme Transition Animation</span>
      </div>

      <div className="flex flex-col items-center">
        <AnimatedThemeToggleButton type="vertical" />
        <span className="mt-2 text-xs">Vertical Theme Transition Animation</span>
      </div>
    </div>
  )
}

Dependencies

More by Arunachalam

View all
  • Scroll media expansion hero

    Scroll media expansion hero

    10.7K
  • Profile Card Testimonial Carousel

    Profile Card Testimonial Carousel

    1.2K
  • Modern Animated Sign In

    Modern Animated Sign In

    1.1K
  • Bottom Nav Bar

    Bottom Nav Bar

    805
  • Adaptive Notch Navigation Bar

    Adaptive Notch Navigation Bar

    661
  • Toast

    Toast

    659
  • Connected Carousel

    Connected Carousel

    383
  • Animated File Tree

    Animated File Tree

    337

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