ThemeToggle
Switches between dark and light with a circular reveal. Web only.
import { ThemeToggle } from '@rajatweb/argent'
<ThemeToggle onThemeChange={track} />Props
| Prop | Type | Default | What it does |
|---|---|---|---|
label | (next: ThemeName) => string | Accessible name for the theme a press will switch to. | |
onThemeChange | (theme: ThemeName) => void | ||
persist | boolean | true | Remember the choice for the next visit. |
Accessibility
- Named by the theme it switches to.
- Switches instantly for reduced motion.
Do
- Inline `themeScript` in the head so a saved theme applies before first paint.
Don’t
- Put two on one page.