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?
"circle" | "rectangle" | "circle-blur" | "blinds"
rectangle
start?
"center" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "bottom-up"
bottom-up

ThemeToggle

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

Animation variant. Default: "rectangle".

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

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

bottom-up
iconClassName?
string
className?
string

Updated