{
  "id": "expanding-search",
  "name": "Expanding Search",
  "category": "forms",
  "tags": [
    "search",
    "expand",
    "icon",
    "focus",
    "input",
    "header"
  ],
  "description": "A round search icon that stretches into a full search field when it gets focus.",
  "url": "https://copy-css.com/snippets/expanding-search",
  "markdown": "https://copy-css.com/snippets/expanding-search.md",
  "html": "<input class=\"search-expand\" type=\"search\" placeholder=\"Search…\" aria-label=\"Search\">",
  "css": ".search-expand {\n  box-sizing: border-box;\n  width: 44px;\n  height: 44px;\n  padding: 0 0 0 42px;\n  border: 1px solid #e2e8f0;\n  border-radius: 999px;\n  background: #fff url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E\") 13px 50% / 17px no-repeat;\n  color: #0f172a;\n  font: 15px system-ui, sans-serif;\n  -webkit-appearance: none;\n  appearance: none;\n  outline: none;\n  cursor: pointer;\n  transition: width 0.35s cubic-bezier(0.3, 0.7, 0.4, 1), border-color 0.2s ease, box-shadow 0.2s ease;\n}\n\n/* Stay open while focused or while it has text */\n.search-expand:focus,\n.search-expand:not(:placeholder-shown) {\n  width: 220px;\n  padding-right: 14px;\n  border-color: #0ea5e9;\n  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);\n  cursor: text;\n}",
  "features": [
    "transitions",
    "box shadows"
  ],
  "customProperties": []
}
