Light, dark or match the system. This one really switches this page, starting from its current theme.
Light, dark or match the system. This one really switches this page, starting from its current theme.
Button-based theme switcher with rotating icons
A classic theme switcher component with animated sun/moon icons
Dropdown theme switcher with system/light/dark options
Multi-button theme switcher with system/light/dark options
Switch-based theme switcher with animated sun/moon icons
Custom toggle theme switcher with sliding animation
A controlled light/dark switch with a morphing sun and moon and a smooth organic page reveal.
Light / system / dark toggle using next-themes.
An accessible React dark mode toggle for Next.js that reveals the new theme from the button with a View Transition: a circle, ink, a wave or a page turn.
A sun/moon button that flips the whole page between dark and light with a View Transition reveal from the button, as a circle or staggered slats.
A day/night switch: the sun rolls across, its rays retract as a shadow bites it into a crescent, clouds drift off and stars burst out and twinkle.
Animated light/dark switch with a sliding knob, sun and moon icons, and bouncy track transitions. Built with Base UI Toggle; toggles the document dark class.
Light/dark (or light/dark/system) toggle that reveals the new theme with a View Transition: a circle from the click point (the button centre for keyboard), a wipe, or a fade. Sun-to-moon icon morph. Instant without View Transitions or under reduced motion. Controlled or uncontrolled (localStorage + .dark on html), SSR-safe, with themeScript() for no flash and transitionTheme() for menus.
A light and dark switch that survives a reload, follows the system when asked, and stays in step across tabs.
The one-button light/dark switch you drop in a navbar, header or settings row — click it and the whole app flips theme, and the choice survives a reload. Reach for it on any site that has a dark mode at all: the header of a marketing or docs site, an app shell or dashboard sidebar, a settings or appearance page, an admin panel, a developer tool or playground, a blog, and the top-right corner of more or less every React starter. Common asks it answers: "dark mode toggle", "theme toggle button", "light dark switcher", "dark mode toggle react", "theme switcher react", "toggle dark mode tailwind", "tailwind dark class toggle", "sun moon toggle button", "dark mode without next-themes", "next-themes alternative", "theme toggle shadcn", "shadcn dark mode toggle component", "shadcn mode toggle", "nextjs dark mode toggle", "vite react dark mode", "react router dark mode", "astro dark mode toggle", "remember user theme localStorage", "respect prefers-color-scheme", "system theme default dark mode", "dark mode flash on page load", "FOUC dark mode nextjs", "hydration mismatch dark mode", "window is not defined dark mode", "toggle dark class on html element", "dark mode toggle without provider", "dark mode toggle accessibility aria-pressed", "ダークモード 切り替え react", "テーマ切り替えボタン", "ダークモード 初回表示 ちらつき", "システム設定に追従 ダークモード". shadcn/ui has no installable toggle, and the measurement is unambiguous: across all sixty-three registry entries (sixty-two fetchable today) the only component that touches theming at all is sonner, which calls next-themes' useTheme to decide what colour to paint a toast — it reads the theme, it does not switch it. The official dark-mode guide is a guide: it hands you a next-themes provider to wire up and a dropdown to assemble yourself, so the button itself is written by hand every time. This is that button — one file, no provider, no context, no next-themes, no extra package. It toggles the `dark` class on the html element, which is exactly what Tailwind's class dark mode and the shadcn tokens already read, so it works with the theme you have rather than introducing another one. On first load it reads the saved choice from localStorage and falls back to the OS `prefers-color-scheme`, so a first-time visitor gets their system theme and a returning one gets their own; every later click writes the choice back. That first read happens in an effect rather than during render, because `window` does not exist on the server and an inline branch would either crash SSR or hydrate to different markup than it sent — which is the `window is not defined` / hydration-mismatch pair that the hand-written version hits first. It also means the theme is applied just after first paint, so add the usual one-line script in your document head if you need to kill the flash on a static page. The Sun/Moon swap is done with the `dark:` variant rather than JS state, so the icon matches the document even if something else on the page changes the theme. It is a real button that forwards every button prop (className, id, onClick, disabled), carries an aria-label and an aria-pressed that reflects the current mode, hides both icons from screen readers, and has a focus-visible ring; styling uses shadcn tokens (accent, muted-foreground, ring, border) so it matches your other icon buttons. Within pulld it sits with the other things that live in a header: kbd and keyboard-shortcuts, command-palette, network-status and announcement-bar. lucide-react is the only dependency.
A light/dark/system theme switch with sun-moon, pill, switch and orb visual treatments.
Class-strategy dark mode toggle with localStorage persistence and no-flash pre-paint script helper.
Switches between light and dark; the sun grows into a moon.
A pill toggle labelled Light mode or Dark mode. Click it and the new theme is drawn in pixels out from the toggle, in one of eight reveals: circle, diamond, equalizer bars, a diagonal sweep, a zipper closing from top and bottom, sparks, sonar rings or a spiral. View Transitions API with the cross-fade switched off; the sun pulls in its rays and the label turns like a drum.
Wipes the new theme in as a circle using View Transitions.
Animated sun and moon toggles that switch between light and dark mode. Search terms: actions.
Iconaut thermometer icon, line, with native fits at 16/20/24px. MIT.
Showing 25,081–25,104 of 26,785
Showing 25,081–25,104 of 26,785