Animated Theme Toggler

A theme toggle button that transitions between light and dark modes with a circular reveal animation.

Click to see the effect

Installation

npx shadcn-vue@latest add https://raya-ui.com/registry/animated-theme-toggler.json

Or manually:

npm install lucide-vue-next clsx tailwind-merge
Note: This component relies on the View Transitions API. It will gracefully degrade to a standard toggle on browsers that don't support it.

Examples

Customization

You can customize the appearance using standard Tailwind classes.

Props

PropTypeDefaultDescription
themestringdarkCurrent theme
durationnumber400Duration of the clip-path animation in milliseconds.
classstring''Custom classes for the button element.

Emits

EventPayloadDescription
update:modelValueanyFired when theme changes.