{
  "id": "star-rating",
  "name": "Star Rating",
  "category": "forms",
  "tags": [
    "rating",
    "stars",
    "review",
    "radio",
    "has"
  ],
  "description": "A clickable five-star rating built from radio buttons, with hover preview.",
  "url": "https://copy-css.com/snippets/star-rating",
  "markdown": "https://copy-css.com/snippets/star-rating.md",
  "html": "<div class=\"rating\">\n  <label><input type=\"radio\" name=\"rating\" value=\"5\" aria-label=\"5 stars\">★</label>\n  <label><input type=\"radio\" name=\"rating\" value=\"4\" aria-label=\"4 stars\" checked>★</label>\n  <label><input type=\"radio\" name=\"rating\" value=\"3\" aria-label=\"3 stars\">★</label>\n  <label><input type=\"radio\" name=\"rating\" value=\"2\" aria-label=\"2 stars\">★</label>\n  <label><input type=\"radio\" name=\"rating\" value=\"1\" aria-label=\"1 star\">★</label>\n</div>",
  "css": "/* Stars are listed 5 → 1 and displayed reversed */\n.rating {\n  display: inline-flex;\n  flex-direction: row-reverse;\n  gap: 4px;\n  font-size: 34px;\n  line-height: 1;\n}\n\n.rating input {\n  position: absolute;\n  opacity: 0;\n  pointer-events: none;\n}\n\n.rating label {\n  color: #d1d5db;\n  cursor: pointer;\n  transition: color 0.15s ease, transform 0.15s ease;\n}\n\n.rating label:hover,\n.rating label:hover ~ label,\n.rating label:has(input:checked),\n.rating label:has(input:checked) ~ label {\n  color: #f59e0b;\n}\n\n.rating label:hover {\n  transform: scale(1.15);\n}",
  "features": [
    "transitions",
    "transforms",
    "Flexbox",
    "the :has() selector",
    "the :checked state (no JavaScript)"
  ],
  "customProperties": []
}
