Arunachalam

Animated Theme Toggler

Buttons 212

About

AnimatedThemeToggler — React Theme Toggle Button with Smooth Icon Transitions A lightweight React component that toggles between light and dark modes with animated sun and moon icons using Framer Motion. It detects and syncs the current theme state with the DOM, supports persistent theme preference via localStorage, and uses the new View Transitions API to animate smooth page background transitions based on the toggle button's position. Features: Clean React hooks-based logic Animated icon transitions using framer-motion Theme persistence and live updates View Transitions API clip-path reveal animation Tailwind CSS compatible styling with customizable classes Accessible button with ARIA labels Perfect for modern React/Next.js projects looking to add a polished theme toggle with smooth UI and excellent UX.

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

Code

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

Usage.tsx

import { AnimatedThemeToggler } from "@/components/ui/animated-theme-toggler"

export default function ThemeSwitchDemo() {
  return (
    <div className="min-h-screen flex items-center justify-center bg-background transition-colors">
      <AnimatedThemeToggler />
    </div>
  );
}

Dependencies

More by Arunachalam

View all
  • Scroll media expansion hero

    Scroll media expansion hero

    10.8K
  • Profile Card Testimonial Carousel

    Profile Card Testimonial Carousel

    1.3K
  • Modern Animated Sign In

    Modern Animated Sign In

    1.1K
  • Bottom Nav Bar

    Bottom Nav Bar

    836
  • Adaptive Notch Navigation Bar

    Adaptive Notch Navigation Bar

    692
  • Toast

    Toast

    661
  • Connected Carousel

    Connected Carousel

    425
  • Animated File Tree

    Animated File Tree

    342

More in Buttons

View all
  • Texture Button

    Texture Button

    97
  • Button

    Button

    5
  • Button Group

    Button Group

  • Eclipse Button

    Eclipse Button

    39
  • Button

    Button

    4
  • HeroUI Button Group

    HeroUI Button Group

  • App Store Button

    App Store Button

    458
  • Base Button

    Base Button

    4