{
  "id": "animated-checkbox",
  "name": "Animated Checkbox",
  "category": "forms",
  "tags": [
    "checkbox",
    "animation",
    "svg",
    "stroke",
    "draw",
    "check mark"
  ],
  "description": "A checkbox whose tick draws itself with an SVG stroke animation and a little bounce when checked.",
  "url": "https://copy-css.com/snippets/animated-checkbox",
  "markdown": "https://copy-css.com/snippets/animated-checkbox.md",
  "html": "<label class=\"check-draw\">\n  <input type=\"checkbox\" checked>\n  <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M5 12.5 10 17 19 7\"/></svg>\n  Send me product updates\n</label>",
  "css": ".check-draw {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 10px;\n  color: #14532d;\n  font: 500 15px system-ui, sans-serif;\n  cursor: pointer;\n}\n\n.check-draw input {\n  flex: none;\n  width: 24px;\n  height: 24px;\n  margin: 0;\n  border: 2px solid #86efac;\n  border-radius: 7px;\n  background: #fff;\n  -webkit-appearance: none;\n  appearance: none;\n  cursor: pointer;\n  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;\n}\n\n.check-draw input:checked {\n  border-color: #16a34a;\n  background: #16a34a;\n  animation: check-draw-pop 0.3s ease;\n}\n\n.check-draw input:focus-visible {\n  outline: 2px solid #16a34a;\n  outline-offset: 2px;\n}\n\n.check-draw svg {\n  position: absolute;\n  left: 3px;\n  width: 18px;\n  height: 18px;\n  fill: none;\n  stroke: #fff;\n  stroke-width: 3;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  stroke-dasharray: 22;\n  stroke-dashoffset: 22;\n  pointer-events: none;\n  transition: stroke-dashoffset 0.3s ease 0.05s;\n}\n\n.check-draw input:checked + svg {\n  stroke-dashoffset: 0;\n}\n\n@keyframes check-draw-pop {\n  50% {\n    transform: scale(1.15);\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .check-draw input,\n  .check-draw svg {\n    transition: none;\n    animation: none;\n  }\n}",
  "features": [
    "keyframe animations",
    "transitions",
    "transforms",
    "Flexbox",
    "the :checked state (no JavaScript)",
    "keyboard focus styles",
    "reduced-motion support"
  ],
  "customProperties": []
}
