Component packs › Livery › Mode Toggle

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.

Mode Toggle props

PropTypeDefaultDescription
nightbooleanStart in dark mode.
darkboolean
autoplayboolean
onChange(mode: 'light' | 'dark' | 'system') => void

Methods on the ref

Use it in React

import ModeToggle from './ModeToggle';

<ModeToggle />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Livery

Good for: Theme and dark mode.