Live Demo

React Theme
Switch Animation

Beautiful, smooth animations for theme switching in React applications.Built with TypeScript and powered by the View Transition API.

Try Different Animations

Click any toggle below to experience the theme switch animations

Circle

Smooth expanding circle transition

Duration750ms
Easingease-in-out
🌀

Blur Circle

Circle with elegant blur effect

Duration750ms
Easingease-in-out
📱

QR Scan

Scanning line sweeps in any direction

Duration750ms
Easingease-in-out
🔷

Polygon

Diagonal wipe sweeping across the screen

Duration750ms
Easingexpo-out
📐

Polygon Gradient

Diagonal wipe with a soft gradient edge

Duration1500ms
Easingexpo-out
🎬

Custom GIF

Reveal the theme through any GIF mask

Duration2000ms
Easingexpo-in

Why Choose This Library?

High Performance

Optimized for high-resolution displays with smooth 60fps animations

🎨

Multiple Animations

Circle, blur circle, QR scan, polygon, polygon gradient, and custom GIF effects

📱

Responsive Design

Works perfectly across all device sizes and screen resolutions

Accessibility First

Respects prefers-reduced-motion and provides fallback experiences

Simple to Use

Get started with just a few lines of code

example.tsx
import { useModeAnimation, ThemeAnimationType } from 'react-theme-switch-animation'

function ThemeToggle() {
  const { ref, toggleSwitchTheme, isDarkMode } = useModeAnimation({
    animationType: ThemeAnimationType.CIRCLE
  })

  return (
    <button ref={ref} onClick={toggleSwitchTheme}>
      {isDarkMode ? '🌙' : '☀️'}
    </button>
  )
}