{
  "id": "star-count-button",
  "name": "Star Count Button",
  "category": "buttons",
  "tags": [
    "github",
    "counter",
    "split pill",
    "favorite",
    "open source"
  ],
  "description": "A GitHub-style Star button with an attached counter that toggles a filled star when checked.",
  "url": "https://copy-css.com/snippets/star-count-button",
  "markdown": "https://copy-css.com/snippets/star-count-button.md",
  "html": "<label class=\"btn-star\">\n  <input type=\"checkbox\" aria-label=\"Star this repository\">\n  <span class=\"btn-star-main\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z\"/></svg>Star</span>\n  <span class=\"btn-star-count\">12.4k</span>\n</label>",
  "css": ".btn-star {\n  position: relative;\n  display: inline-flex;\n  border: 1px solid #d0d7de;\n  border-radius: 8px;\n  background: #f6f8fa;\n  color: #24292f;\n  font: 600 14px/1 system-ui, sans-serif;\n  cursor: pointer;\n  user-select: none;\n}\n\n.btn-star input {\n  position: absolute;\n  inset: 0;\n  margin: 0;\n  opacity: 0;\n  cursor: pointer;\n}\n\n.btn-star-main {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 8px 12px;\n}\n\n.btn-star svg {\n  width: 16px;\n  height: 16px;\n  fill: none;\n  stroke: #57606a;\n  stroke-width: 2;\n  stroke-linejoin: round;\n  transition: fill 0.15s ease, stroke 0.15s ease, transform 0.15s ease;\n}\n\n.btn-star-count {\n  padding: 8px 10px;\n  border-left: 1px solid #d0d7de;\n  font-variant-numeric: tabular-nums;\n}\n\n.btn-star:hover {\n  background: #eef1f4;\n}\n\n.btn-star input:checked + .btn-star-main svg {\n  fill: #e3b341;\n  stroke: #e3b341;\n  transform: scale(1.15);\n}\n\n.btn-star:has(input:focus-visible) {\n  outline: 2px solid #0969da;\n  outline-offset: 2px;\n}",
  "features": [
    "transitions",
    "transforms",
    "Flexbox",
    "the :has() selector",
    "the :checked state (no JavaScript)",
    "keyboard focus styles"
  ],
  "customProperties": []
}
