Skip to content

Radio Pulse

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

Toggles & InputsHTMLCSSany framework

Copy into your project

HTML
<!-- Radio Pulse — radio buttons with pulse animation on select -->
<fieldset class="nuda-radio-group">
  <legend class="nuda-radio-group__legend">Choose an option</legend>

  <label class="nuda-radio">
    <input class="nuda-radio__input" type="radio" name="nuda-demo" value="a" checked />
    <span class="nuda-radio__circle"></span>
    <span class="nuda-radio__label">Option A</span>
  </label>

  <label class="nuda-radio">
    <input class="nuda-radio__input" type="radio" name="nuda-demo" value="b" />
    <span class="nuda-radio__circle"></span>
    <span class="nuda-radio__label">Option B</span>
  </label>

  <label class="nuda-radio">
    <input class="nuda-radio__input" type="radio" name="nuda-demo" value="c" />
    <span class="nuda-radio__circle"></span>
    <span class="nuda-radio__label">Option C</span>
  </label>
</fieldset>
CSS
/* ── Radio Pulse ─────────────────────────────────────────────
   Customize:
     --nuda-rp-clr     : accent color
     --nuda-rp-size    : circle size
     --nuda-rp-dot     : inner dot size
   ──────────────────────────────────────────────────────────── */
.nuda-radio-group {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nuda-radio-group__legend {
  font-weight: 600;
  margin-bottom: 8px;
}

.nuda-radio {
  --nuda-rp-clr: #6366f1;
  --nuda-rp-size: 20px;
  --nuda-rp-dot: 10px;

  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.nuda-radio__input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nuda-radio__circle {
  position: relative;
  width: var(--nuda-rp-size);
  height: var(--nuda-rp-size);
  border: 2px solid #d1d5db;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease;
}

/* Inner dot */
.nuda-radio__circle::after {
  content: "";
  width: var(--nuda-rp-dot);
  height: var(--nuda-rp-dot);
  border-radius: 50%;
  background: var(--nuda-rp-clr);
  transform: scale(0);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Checked state */
.nuda-radio__input:checked + .nuda-radio__circle {
  border-color: var(--nuda-rp-clr);
  animation: nuda-radio-pulse 0.4s ease;
}

.nuda-radio__input:checked + .nuda-radio__circle::after {
  transform: scale(1);
}

/* Focus ring */
.nuda-radio__input:focus-visible + .nuda-radio__circle {
  outline: 2px solid var(--nuda-rp-clr);
  outline-offset: 2px;
}

@keyframes nuda-radio-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  100% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
}

.nuda-radio__label {
  font-size: 0.95rem;
}

/* ── Accessibility ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .nuda-radio__circle,
  .nuda-radio__circle::after {
    transition: none;
  }
  .nuda-radio__input:checked + .nuda-radio__circle {
    animation: none;
  }
}

How to use Radio Pulse

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 toggles & inputs components

← Browse all NudaUI components