Dark Mode Toggle

Compact sun and moon switch that persists theme preference and toggles the document dark class.

Add to your project

1Connect the Uniquel MCP

Connect Uniquel to your coding agent before using the component ID.

Connect MCP

2Copy the component ID

MCP ID
component:navigation/dark-mode-toggle

Works with your AI tools

ClaudeClaude*
CodexCodex*
LovableLovable
Base44Base44
Figma MakeFigma Make
ReplitReplit*
CursorCursor*
v0v0

* Compatible with most projects that use the default React/Next.js framework.

Built With

ReactTailwind CSSFramer Motion

Props

PropTypeDescription
storageKeystringlocalStorage key for the saved theme
applyToDocumentbooleanToggle the dark class on documentElement
defaultDarkbooleanInitial theme before storage is read
onChange(dark: boolean) => voidFired when the theme changes
classNamestringStyles for the switch

More Navigation Components

Compact next button with a looping arrow reveal, crisp press feedback, and loading and disabled states.

New: Coverflow Gallery is live — explore the catalog. See what's new

Restrained product update strip with gradient sheen and a clean collapse dismiss.

Minimal locale control with scaled blur-sm menu and staggered options — no native select chrome.

Numbered pagination that keeps the current page visible and collapses long ranges with ellipses.

Compact pagination controls with arrows and dots by default, plus optional page numbers.