Skip to content

BavariaMotion

Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Live, interactive React component · light themeResponsive

About the Bavaria Dark Mode Toggle

The light/dark switch for a navbar: a bare round icon button with a thin moon (a sun in dark mode) that fills sage under the pointer; add className="border-line!" for the hairline circle. Both icons and both labels are in the server HTML and CSS shows the pair for <html data-theme>, so nothing flashes and hydration matches; the icon that comes in fades up with a small turn; the choice is saved. Client component.

It is part of Bavaria: chalk pages, architectural photos, sage and forest green. The style’s 93 pieces share one set of tokens, type and motion, in a light and a dark theme, so whatever you take from it fits together.

To put it in your project, copy the prompt into Claude Code, OpenAI Codex or Cursor, or add it by hand. The documentation walks through both.

The same piece, drawn for a different look. Open one to compare it live.

Aeris Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Form & Field Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Glass Meridian Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Grove Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Neo-Brutal Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Noir Aurora Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Soft Bento Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.

Swiss Tech Mono Dark Mode Toggle

A light/dark switch for the navbar that saves the choice and shows the right icon with no flash.