{
  "id": "category-search-bar",
  "name": "Search with Category",
  "category": "forms",
  "tags": [
    "search",
    "category",
    "select",
    "marketplace",
    "input group",
    "button"
  ],
  "description": "A marketplace search bar that joins a category select, a search field and a search button into one pill.",
  "url": "https://copy-css.com/snippets/category-search-bar",
  "markdown": "https://copy-css.com/snippets/category-search-bar.md",
  "html": "<form class=\"cat-search\" role=\"search\">\n  <select name=\"cat\" aria-label=\"Category\">\n    <option>All</option>\n    <option>Books</option>\n    <option>Music</option>\n  </select>\n  <input type=\"search\" name=\"q\" placeholder=\"Search products\" aria-label=\"Search products\">\n  <button type=\"submit\" aria-label=\"Search\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.5-3.5\"/></svg>\n  </button>\n</form>",
  "css": ".cat-search {\n  display: flex;\n  width: 100%;\n  max-width: 320px;\n  overflow: hidden;\n  border: 2px solid #f97316;\n  border-radius: 12px;\n  background: #fff;\n  font-family: system-ui, sans-serif;\n}\n\n.cat-search:focus-within {\n  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2);\n}\n\n.cat-search select {\n  padding: 0 24px 0 12px;\n  border: 0;\n  border-right: 1px solid #fed7aa;\n  background: #fff7ed url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a3412' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\") no-repeat right 8px center / 10px;\n  color: #7c2d12;\n  font: 600 13px system-ui, sans-serif;\n  -webkit-appearance: none;\n  appearance: none;\n  cursor: pointer;\n}\n\n.cat-search input {\n  flex: 1;\n  min-width: 0;\n  padding: 10px 12px;\n  border: 0;\n  background: transparent;\n  color: #1c1917;\n  font: 15px system-ui, sans-serif;\n}\n\n.cat-search button {\n  display: grid;\n  place-items: center;\n  width: 46px;\n  border: 0;\n  background: #f97316;\n  color: #fff;\n  cursor: pointer;\n}\n\n.cat-search button:hover {\n  background: #ea580c;\n}\n\n.cat-search svg {\n  width: 18px;\n  height: 18px;\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 2.5;\n  stroke-linecap: round;\n}\n\n.cat-search select:focus-visible,\n.cat-search input:focus-visible,\n.cat-search button:focus-visible {\n  outline: 2px solid #9a3412;\n  outline-offset: -3px;\n}",
  "features": [
    "box shadows",
    "CSS Grid",
    "Flexbox",
    "keyboard focus styles"
  ],
  "customProperties": []
}
