{
  "id": "heart-like-toggle",
  "name": "Heart Like Button",
  "category": "effects",
  "tags": [
    "like",
    "heart",
    "favorite",
    "toggle",
    "checkbox",
    "pop"
  ],
  "description": "A heart that fills and pops with a burst ring when liked, built on a plain checkbox.",
  "url": "https://copy-css.com/snippets/heart-like-toggle",
  "markdown": "https://copy-css.com/snippets/heart-like-toggle.md",
  "html": "<label class=\"like\">\n  <input type=\"checkbox\" aria-label=\"Like\">\n  <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M12 20.5 4.1 12.8A5 5 0 0 1 12 6.6a5 5 0 0 1 7.9 6.2Z\"/></svg>\n</label>",
  "css": ".like {\n  position: relative;\n  display: inline-grid;\n  place-items: center;\n  width: 56px;\n  height: 56px;\n  border-radius: 50%;\n  cursor: pointer;\n  transition: background 0.2s ease;\n}\n\n.like:hover {\n  background: #ffe4e6;\n}\n\n.like input {\n  position: absolute;\n  inset: 0;\n  margin: 0;\n  opacity: 0;\n  cursor: pointer;\n}\n\n.like svg {\n  width: 30px;\n  height: 30px;\n  fill: transparent;\n  stroke: #71717a;\n  stroke-width: 2;\n  stroke-linejoin: round;\n  pointer-events: none;\n  transition: fill 0.2s ease, stroke 0.2s ease;\n}\n\n.like:hover svg {\n  stroke: #f43f5e;\n}\n\n.like input:checked + svg {\n  fill: #f43f5e;\n  stroke: #f43f5e;\n  animation: like-pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);\n}\n\n/* Burst ring */\n.like::after {\n  content: \"\";\n  position: absolute;\n  inset: 6px;\n  border: 2px solid #f43f5e;\n  border-radius: 50%;\n  opacity: 0;\n  pointer-events: none;\n}\n\n.like:has(input:checked)::after {\n  animation: like-burst 0.5s ease-out;\n}\n\n.like:has(input:focus-visible) {\n  outline: 2px solid #f43f5e;\n  outline-offset: 2px;\n}\n\n@keyframes like-pop {\n  from { transform: scale(0.6); }\n}\n\n@keyframes like-burst {\n  from { opacity: 1; transform: scale(0.5); }\n  to { opacity: 0; transform: scale(1.3); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .like input:checked + svg,\n  .like:has(input:checked)::after { animation: none; }\n}",
  "features": [
    "keyframe animations",
    "transitions",
    "transforms",
    "CSS Grid",
    "the :has() selector",
    "the :checked state (no JavaScript)",
    "keyboard focus styles",
    "reduced-motion support"
  ],
  "customProperties": []
}
