Skip to content

Circle Reveal

A copy-paste theme toggle component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Theme ToggleHTMLCSSany framework

Light

Dark

Copy into your project

HTML
<!-- Circle Reveal — radial wipe between light + dark layers -->
<div class="nuda-circle">
  <div class="nuda-circle__light">
    <span class="nuda-circle__sun"></span>
    <p class="nuda-circle__text">Light</p>
  </div>
  <div class="nuda-circle__dark">
    <span class="nuda-circle__moon"></span>
    <p class="nuda-circle__text">Dark</p>
  </div>
  <button class="nuda-circle__btn" type="button">Toggle</button>
</div>
CSS
/* Circle Reveal
   Two layers (light/dark); the dark one expands from a corner via clip-path.
   Pair with the View Transitions API in production for full-page transitions.
   Customize: --circle-origin, --circle-duration */

.nuda-circle {
  --circle-origin-x: 90%;
  --circle-origin-y: 18%;
  --circle-duration: 0.8s;
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
}

.nuda-circle__light,
.nuda-circle__dark {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nuda-circle__light {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.nuda-circle__dark {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  clip-path: circle(0% at var(--circle-origin-x) var(--circle-origin-y));
  transition: clip-path var(--circle-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

.nuda-circle:hover .nuda-circle__dark,
.nuda-circle.is-dark .nuda-circle__dark {
  clip-path: circle(150% at var(--circle-origin-x) var(--circle-origin-y));
}

.nuda-circle__sun {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 16px #fbbf24;
}

.nuda-circle__moon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e4ff54, #a8c93a);
  box-shadow: 0 0 12px rgba(228, 255, 84, 0.5);
}

.nuda-circle__text {
  font: 600 0.75rem ui-sans-serif, system-ui, sans-serif;
  margin: 0;
}

.nuda-circle__light .nuda-circle__text { color: #92400e; }
.nuda-circle__dark  .nuda-circle__text { color: #e4ff54; }

.nuda-circle__btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: inherit;
  border-radius: 5px;
  font: 600 0.7rem ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(4px);
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  .nuda-circle__dark { transition: none; }
}

How to use Circle Reveal

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More theme toggle components

← Browse all NudaUI components