CSS Animated Checkbox

A checkbox whose tick draws itself with an SVG stroke animation and a little bounce when checked.

  • checkbox
  • animation
  • svg
  • stroke
  • draw
  • check mark
HTML
<label class="check-draw">
  <input type="checkbox" checked>
  <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5 10 17 19 7"/></svg>
  Send me product updates
</label>
CSS
.check-draw {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #14532d;
  font: 500 15px system-ui, sans-serif;
  cursor: pointer;
}

.check-draw input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid #86efac;
  border-radius: 7px;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.check-draw input:checked {
  border-color: #16a34a;
  background: #16a34a;
  animation: check-draw-pop 0.3s ease;
}

.check-draw input:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

.check-draw svg {
  position: absolute;
  left: 3px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  pointer-events: none;
  transition: stroke-dashoffset 0.3s ease 0.05s;
}

.check-draw input:checked + svg {
  stroke-dashoffset: 0;
}

@keyframes check-draw-pop {
  50% {
    transform: scale(1.15);
  }
}

@media (prefers-reduced-motion: reduce) {
  .check-draw input,
  .check-draw svg {
    transition: none;
    animation: none;
  }
}

About this CSS Animated Checkbox

This CSS Animated Checkbox is 68 lines of pure CSS (1.2 KB) with no JavaScript and no dependencies. It uses keyframe animations, transitions, transforms and Flexbox. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #14532d
  • #86efac
  • #fff
  • #16a34a

How to use this animated checkbox

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .check-draw class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback