Theme Toggle
A button that switches between light and dark mode with a circular expand view-transition animation and cross-fading icon swap.
Installation
npx stepwise-ui add theme-toggle
Usage
API
ThemeToggle
No props. Reads and writes theme state via useTheme() internally. Place it anywhere inside ThemeProvider.
useTheme()
NameTypeDescription
theme"dark" | "light"The current active theme.
toggle(e: MouseEvent) => voidSwitches theme and triggers the circular view-transition from the click origin.
ThemeProvider
Wrap your root layout with ThemeProvider to enable theme context. It reads localStorage on mount and syncs the dark class on <html>.