Theme Toggle

Theme toggle button that repaints the whole page through the View Transition API — a rectangle or circle clip-path reveal, or slats that open across the screen like a shutter.

Preview

Rectangle
Circle
Circle blur
Blinds

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/theme-toggle

API Reference

useThemeToggle

variant?
"rectangle" | "circle" | "circle-blur" | "blinds"
rectangle
start?
"top-left" | "top-right" | "bottom-left" | "bottom-right" | "center" | "bottom-up"
bottom-up

ThemeToggle

variant?
"rectangle" | "circle" | "circle-blur" | "blinds"

Animation variant. Default: "rectangle".

rectangle
start?
"top-left" | "top-right" | "bottom-left" | "bottom-right" | "center" | "bottom-up"

Origin direction for the reveal. Default: "bottom-up".

bottom-up
iconClassName?
string

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated