Checkbox Bounce
A copy-paste toggles & inputs component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Toggles & InputsHTMLCSSany framework
Copy into your project
HTML
<!-- Checkbox Bounce — checkbox with bouncy checkmark animation -->
<label class="nuda-checkbox">
<input class="nuda-checkbox__input" type="checkbox" />
<span class="nuda-checkbox__box">
<svg class="nuda-checkbox__icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M3.5 8.5L6.5 11.5L12.5 4.5" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
<span class="nuda-checkbox__label">Accept terms</span>
</label>CSS
/* ── Checkbox Bounce ─────────────────────────────────────────
Customize:
--nuda-cb-size : box size
--nuda-cb-clr : accent color
--nuda-cb-radius : corner radius
──────────────────────────────────────────────────────────── */
.nuda-checkbox {
--nuda-cb-size: 22px;
--nuda-cb-clr: #6366f1;
--nuda-cb-radius: 6px;
display: inline-flex;
align-items: center;
gap: 8px;
cursor: pointer;
-webkit-user-select: none;
user-select: none;
}
.nuda-checkbox__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-checkbox__box {
width: var(--nuda-cb-size);
height: var(--nuda-cb-size);
border: 2px solid #d1d5db;
border-radius: var(--nuda-cb-radius);
display: inline-flex;
align-items: center;
justify-content: center;
transition: background 0.2s, border-color 0.2s;
}
.nuda-checkbox__icon {
width: 14px;
height: 14px;
color: #fff;
transform: scale(0);
transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Checked state */
.nuda-checkbox__input:checked + .nuda-checkbox__box {
background: var(--nuda-cb-clr);
border-color: var(--nuda-cb-clr);
}
.nuda-checkbox__input:checked + .nuda-checkbox__box .nuda-checkbox__icon {
transform: scale(1);
}
/* Focus ring */
.nuda-checkbox__input:focus-visible + .nuda-checkbox__box {
outline: 2px solid var(--nuda-cb-clr);
outline-offset: 2px;
}
.nuda-checkbox__label {
font-size: 0.95rem;
}
/* ── Accessibility ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
.nuda-checkbox__icon,
.nuda-checkbox__box {
transition: none;
}
}How to use Checkbox Bounce
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.