Component packs › Livery › Mode Toggle
The sun’s rays fold in and it becomes a moon while dark mode opens over the page from the toggle.
Mode Toggle is a light and dark toggle from Livery, a component pack with 8 components: Theme switcher components where every change repaints the page, not just the control. Price: $2 for the whole pack.
Built with: sun to moon morph, reveal from the toggle, system option.
Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.
| Prop | Type | Default | Description |
|---|---|---|---|
night | boolean | Start in dark mode. | |
dark | boolean | ||
autoplay | boolean | ||
onChange | (mode: 'light' | 'dark' | 'system') => void |
set(mode: 'light' | 'dark' | 'system'): voiddestroy(): voidimport ModeToggle from './ModeToggle';
<ModeToggle />The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.
Good for: Theme and dark mode.