motionsnack

Animated React sections that already feel finished.

Copy them into Next.js or add them with one command. Plain React and Tailwind, light and dark.

New sections, once a month

One short email when something new lands. No spam.

Library

  • Sections
  • Blocks
  • Components
  • Application UI
  • Templates

Popular

  • Hero
  • Gallery
  • Testimonials
  • Stats
  • Logos
  • FAQ

Resources

  • Installation
  • All components
  • All blocks
  • All sections
  • All application UI
  • Design system
  • Changelog
  • Pricing

Company

  • About
  • Contact
  • Terms
  • Privacy

Install

npx motionsnack add <name>Step-by-step guidehello@motionsnack.dev
Kuba Šťastný@kubastastnydev

© 2026 motionsnack. All rights reserved.

TermsPrivacy

motionsnack

motionsnack
DocsSectionsTemplatesWhat's newPricing
Get lifetime access
  1. Home
  2. Docs
  3. Components
  4. Toggle
  5. Theme Toggle
ComponentsBlocksSectionsApplication UI
ComponentsBlocksSectionsApplication UI

Accordion

  • Spring Accordion

Alert

  • Glow Alert

Audio

  • Podcast PlayerNew
  • Voice NoteNew
  • Voice RecorderNew

Avatar

  • Avatar Stack

Badge

  • Pulse Badge

Breadcrumb

  • Slide Breadcrumb

Button

  • Chip ButtonNew
  • Glow Border Button
  • Glow ButtonNew
  • Plain ButtonNew

Calendar

  • Month Calendar

Checkbox

  • Checkbox CardsNew
  • Checkbox GroupNew
  • Chip CheckboxNew

Cropper

  • Image Cropper

Dialog

  • Spring Dialog

Dropdown

  • Command MenuNew
  • Stagger Dropdown
  • Switcher DropdownNew

File Upload

  • Drop Zone Upload

Input

  • Addon InputNew
  • Button InputNew
  • Copy InputNew
  • Date InputNew
  • Floating Label Input
  • Joined InputsNew
  • Notched Label InputNew
  • Number StepperNew
  • OTP InputNew
  • Password InputNew
  • Phone InputNew
  • Range InputNew
  • Search InputNew
  • Tag InputNew
  • Text FieldNew

Loader

  • Curtain LoaderNew
  • Greeting LoaderNew
  • Line LoaderNew
  • Meter LoaderNew
  • Split LoaderNew

Navigation Menu

  • Mobile Tab BarNew

Notification

  • Notification BellNew
  • Toast Stack

Pagination

  • Sliding Pagination

Popover

  • Spring Popover

Radio

  • Card Radio Group
  • Payment MethodNew
  • Radio GroupNew
  • Rating RadioNew

Select

  • ComboboxNew
  • Glide Select
  • Multi SelectNew
  • Rich SelectNew
  • Select FieldNew
  • Tree SelectNew

Sidebar

  • Icon RailNew

Slider

  • Glow Slider

Stepper

  • Progress Stepper

Switch

  • Billing SwitchNew
  • Switch RowNew
  • Toggle SwitchNew

Table

  • Sortable Table

Tabs

  • Sliding Tabs

Textarea

  • Auto Grow Textarea

Toggle

  • Icon ToggleNew
  • Theme ToggleNew
  • Toggle GroupNew

Tooltip

  • Follow Tooltip

Toggle

Theme Toggle

New

A light and dark toggle whose sun turns into a moon, as an icon button or a small switch.

npx motionsnack add theme-toggle

Customize

<ThemeToggle />

Props

10 properties

PropertyTypeDefaultDescription
value'light' | 'dark'-Controlled theme. Leave undefined to let the component manage it.
defaultValue'light' | 'dark''dark'Theme on first render when uncontrolled.
onChange(value: 'light' | 'dark') => void-Called with the new theme on every change.
applyToDocumentbooleanfalseSwitch the page itself: toggles the dark class on <html> and remembers the choice in localStorage.
storageKeystring'theme'localStorage key used with applyToDocument.
classNamestring''Extra classes on the button.
variant'icon' | 'switch''icon'Round icon button, or a small track with a sun and a moon at the ends.
size'sm' | 'md' | 'lg''md'Icon button 28 / 36 / 44 px (44 on touch), switch track 46 / 56 / 66 px wide.
labelstring'Dark mode'Accessible name of the toggle.
disabledbooleanfalseDisables the toggle.

About Theme Toggle

Theme Toggle is the light and dark switch for a site header or a settings page. On a click the sun's rays pull in and spin away while the disc grows and a shadow slides across it to carve a crescent, and the same in reverse; it is all SVG and CSS, so it stays sharp at any size and costs nothing to load. It comes as a round icon button or as a small track with a faint sun and moon at its ends and a thumb that carries the living icon across. Left alone it simply reports the chosen theme; with one prop it switches the page itself, toggling the dark class on the document and remembering the choice in local storage without a flash on the next visit. It has three sizes, the library's soft focus outline and a switch role for screen readers.

What's included

  • Sun that morphs into a moon, in SVG and CSS
  • Icon button or switch with a sliding thumb
  • Optional page switching with a remembered choice
  • No flash on load when it drives the page
  • Three sizes and an adjustable morph speed
  • Switch role, keyboard and focus outline
  • Light and dark look
Type
Animated React toggle component
Library
Components · Toggle
Stack
Next.js, React, Tailwind CSS
Added
2026-11-23
Install
npx motionsnack add theme-toggle