{
  "id": "checkbox-chips",
  "name": "Checkbox Chips",
  "category": "forms",
  "tags": [
    "chips",
    "tags",
    "filter",
    "checkbox",
    "multi-select"
  ],
  "description": "Toggleable filter chips made from checkboxes, with a check icon when selected.",
  "url": "https://copy-css.com/snippets/checkbox-chips",
  "markdown": "https://copy-css.com/snippets/checkbox-chips.md",
  "html": "<fieldset class=\"chips\">\n  <legend>Topics</legend>\n  <label><input type=\"checkbox\" checked>Design</label>\n  <label><input type=\"checkbox\">Code</label>\n  <label><input type=\"checkbox\" checked>Motion</label>\n  <label><input type=\"checkbox\">Audio</label>\n</fieldset>",
  "css": ".chips {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 8px;\n  max-width: 280px;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  font: 500 14px/1 system-ui, sans-serif;\n}\n\n.chips legend {\n  width: 100%;\n  margin-bottom: 10px;\n  color: #3f3f46;\n  font-weight: 700;\n}\n\n.chips label {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 8px 14px;\n  border: 1.5px solid #e4e4e7;\n  border-radius: 999px;\n  color: #3f3f46;\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n\n.chips input {\n  flex: none;\n  color: inherit;\n  width: 0;\n  height: 14px;\n  margin: 0 -6px 0 0; /* hides the gap while unchecked */\n  border: 0;\n  background: currentColor;\n  -webkit-mask: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") center / contain no-repeat;\n  mask: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") center / contain no-repeat;\n  appearance: none;\n  transition: width 0.15s ease, margin 0.15s ease;\n}\n\n.chips label:has(:checked) {\n  border-color: #18181b;\n  background: #18181b;\n  color: #fff;\n}\n\n.chips input:checked {\n  width: 14px;\n  margin-right: 0;\n}\n\n.chips label:has(:focus-visible) {\n  outline: 2px solid #18181b;\n  outline-offset: 2px;\n}",
  "features": [
    "transitions",
    "masks",
    "Flexbox",
    "the :has() selector",
    "the :checked state (no JavaScript)",
    "keyboard focus styles"
  ],
  "customProperties": []
}
