Brand
Theme toggler
Switches between light and dark with a circular reveal from the button, using the View Transitions API where the browser has it.
packages/design-system/components/theme-toggler-2.tsx
Examples
Anatomy
- 01Button with an aria-label
- 02Sun in dark mode, moon in light
- 03Clip-path reveal on ::view-transition-new(root)
Usage
import { AnimatedThemeToggler } from "@repo/design-system/components/theme-toggler-2";
<AnimatedThemeToggler className="f-p-xs hover:text-brand" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | none | On the button, or on the icon when asChild is set. |
| asChild | boolean | false | Renders only the icon, for when the parent is already the button. The click handler is then the parent's job. |
Guidance
Do
- Keep one on the page, in the footer.
Don't
- Put it inside the design system's pages to judge specimens; they stay light on purpose.