HTML Dropdown — Select Element Reference and Patterns
An HTML dropdown is `<select>` containing `<option>` elements. Native dropdowns are the default — they're accessible, mobile-friendly, and require zero JavaScript. Reach for custom dropdowns only when the native UX is genuinely insufficient.
The HTML dropdown is `<select>` with one or more `<option>` children. Each option has a `value` (submitted) and visible label text (displayed). Use the `selected` attribute to default-select an option; use `disabled` to disable individual options or the whole select.
Multi-select dropdowns use the `multiple` attribute on `<select>`. The submitted value becomes an array of selected option values — your backend receives multiple entries for the same field name. The `size` attribute controls how many rows are visible at once. UX warning: multi-select is hard for users — most people don't know to hold Ctrl/Cmd. For multi-choice, checkboxes are often better.
Group related options with `<optgroup label="...">`. The group label is visible (slightly indented header), the options appear inside. Useful for long dropdowns where users need visual orientation (countries grouped by continent, products grouped by category).
Custom-styled dropdowns are popular, but they almost always break accessibility, mobile UX, and keyboard navigation. Native `<select>` is harder to style but trivially accessible. If you must build a custom one, use Radix UI's `<Select>` primitive or another headless library that handles ARIA, keyboard, and focus management correctly.
How to set this up
Use native <select> by default
Accessible, mobile-friendly, keyboard-navigable. No library needed.
Add an empty default option
<option value="">— select —</option> at the top. Required works correctly only when the default value is empty.
Use <optgroup> for long lists
Visual grouping by category (continent, type, etc.). Helps users orient in long dropdowns.
Reach for custom only when needed
Radix UI Select or similar headless library if you must. Don't roll your own ARIA-correct select.
Native <select> is the default. Custom only when you genuinely need it.
Frequently asked questions
How do I create a dropdown in HTML?
Use the <select> element with <option> children. Each option has a value attribute (submitted) and visible label text. Wrap in a <label> for accessibility. Required + an empty default option blocks submission until the user picks.
How do I make a multi-select dropdown in HTML?
Add the `multiple` attribute to <select>. Users hold Ctrl/Cmd to select multiple options. Backend receives an array of values. UX note: most users don't know about Ctrl/Cmd-click — checkboxes are often a better multi-choice UI.
How do I default-select an option in HTML?
Add the `selected` attribute to the option you want pre-selected: `<option value="us" selected>United States</option>`. Only one option can be `selected` in a single-select; multiple can be `selected` in a multi-select.
Can I style a native HTML select?
Limitedly. Background, padding, border, and font work via CSS. The dropdown arrow and the open dropdown UI are browser-controlled. For full styling, use a headless library (Radix UI Select) that builds an accessible custom dropdown.
How do I group options in an HTML dropdown?
Wrap related options in <optgroup label="Group name">. The label displays as a slightly-indented header above the grouped options. Common pattern: countries grouped by continent, products grouped by category.
Related guides
Ship the form, not the backend.
Free for 1,000 submissions/month. Email delivery, AI spam filtering, signed webhooks, real dashboard — all on the free plan. No credit card.
Get a free access key →