{
  "id": "floating-label-select",
  "name": "Floating Label Select",
  "category": "forms",
  "tags": [
    "select",
    "floating label",
    "dropdown",
    "placeholder",
    "invalid",
    "form"
  ],
  "description": "A native select with a label that sits inside like a placeholder, then floats up once an option is chosen.",
  "url": "https://copy-css.com/snippets/floating-label-select",
  "markdown": "https://copy-css.com/snippets/floating-label-select.md",
  "html": "<label class=\"float-select\">\n  <select name=\"country\" required>\n    <option value=\"\" disabled selected></option>\n    <option>Canada</option>\n    <option>Germany</option>\n    <option>Japan</option>\n  </select>\n  <span>Country</span>\n</label>",
  "css": ".float-select {\n  position: relative;\n  display: block;\n  width: 240px;\n  font-family: system-ui, sans-serif;\n}\n\n.float-select select {\n  box-sizing: border-box;\n  width: 100%;\n  height: 54px;\n  padding: 20px 40px 4px 14px;\n  border: 1.5px solid #a7f3d0;\n  border-radius: 10px;\n  background: #fff url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23047857' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\") no-repeat right 14px center / 16px;\n  color: #064e3b;\n  font: 16px system-ui, sans-serif;\n  -webkit-appearance: none;\n  appearance: none;\n  cursor: pointer;\n}\n\n.float-select span {\n  position: absolute;\n  top: 10px;\n  left: 15px;\n  color: #059669;\n  font-size: 12px;\n  pointer-events: none;\n  transition: top 0.2s ease, font-size 0.2s ease;\n}\n\n.float-select select:invalid + span {\n  top: 17px;\n  color: #6b7280;\n  font-size: 16px;\n}\n\n.float-select select:focus-visible {\n  border-color: #059669;\n  outline: none;\n  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .float-select span {\n    transition: none;\n  }\n}",
  "features": [
    "transitions",
    "box shadows",
    "keyboard focus styles",
    "reduced-motion support"
  ],
  "customProperties": []
}
