Neon Toggle
A copy-paste neon & glow component in pure HTML, CSS & vanilla JS. Zero dependencies, framework-agnostic, MIT-licensed.
Neon & GlowHTMLCSSJavaScriptany framework
Copy into your project
HTML
<!-- Neon Toggle — switch with a glowing track -->
<button class="nuda-neon-toggle is-on" role="switch" aria-checked="true" aria-label="Toggle neon">
<span class="nuda-neon-toggle__thumb"></span>
</button>CSS
/* ── Neon Toggle ─────────────────────────────────────────────
Track + thumb light up when the .is-on class is present.
Toggle .is-on (and aria-checked) from JS on click.
Customize:
--neon-toggle-color : neon hue
──────────────────────────────────────────────────────────── */
.nuda-neon-toggle {
--neon-toggle-color: #e4ff54;
position: relative;
width: 56px;
height: 30px;
padding: 0;
border: 1px solid rgba(228, 255, 84, 0.2);
border-radius: 99px;
background: #16161c;
cursor: pointer;
transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.nuda-neon-toggle__thumb {
position: absolute;
top: 50%;
left: 3px;
width: 22px;
height: 22px;
border-radius: 50%;
background: #5b5b66;
transform: translateY(-50%);
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s, box-shadow 0.3s;
will-change: transform;
}
.nuda-neon-toggle.is-on {
border-color: rgba(228, 255, 84, 0.7);
box-shadow: inset 0 0 10px rgba(228, 255, 84, 0.3), 0 0 12px rgba(228, 255, 84, 0.35);
}
.nuda-neon-toggle.is-on .nuda-neon-toggle__thumb {
transform: translate(26px, -50%);
background: var(--neon-toggle-color);
box-shadow: 0 0 8px var(--neon-toggle-color), 0 0 16px rgba(228, 255, 84, 0.7);
}
.nuda-neon-toggle:focus-visible {
outline: 2px solid var(--neon-toggle-color);
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.nuda-neon-toggle,
.nuda-neon-toggle__thumb { transition: none; }
}JavaScript
/* Toggle the .is-on class and keep aria-checked in sync. */
document.querySelectorAll(".nuda-neon-toggle").forEach(function (sw) {
sw.addEventListener("click", function () {
var on = sw.classList.toggle("is-on");
sw.setAttribute("aria-checked", on ? "true" : "false");
});
});How to use Neon Toggle
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.