Skip to content

Checkbox Draw

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 Draw — the checkmark draws itself in via stroke-dashoffset -->
<label class="nuda-checkbox-draw">
  <input type="checkbox" />
  <span class="nuda-checkbox-draw__box">
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
      <polyline points="20 6 9 17 4 12"/>
    </svg>
  </span>
  <span class="nuda-checkbox-draw__label">I agree</span>
</label>
CSS
.nuda-checkbox-draw {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.nuda-checkbox-draw input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0,0,0,0);
  overflow: hidden;
}

.nuda-checkbox-draw__box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid #555;
  border-radius: 7px;
  color: #e4ff54;
  transition: border-color .25s ease,background .25s ease;
}

.nuda-checkbox-draw__box svg {
  width: 15px;
  height: 15px;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  transition: stroke-dashoffset .4s cubic-bezier(.65,0,.35,1);
}

.nuda-checkbox-draw input:checked+.nuda-checkbox-draw__box {
  border-color: #e4ff54;
}

.nuda-checkbox-draw input:checked+.nuda-checkbox-draw__box svg {
  stroke-dashoffset: 0;
}

.nuda-checkbox-draw input:focus-visible+.nuda-checkbox-draw__box {
  outline: 2px solid #e4ff54;
  outline-offset: 3px;
}

.nuda-checkbox-draw__label {
  color: #fafafa;
  font-size: 14px;
}

@media (prefers-reduced-motion:reduce) {
  .nuda-checkbox-draw__box,.nuda-checkbox-draw__box svg {
    transition: none;
  }
}

How to use Checkbox Draw

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