<labelfor="baseline-select">Choose a technology</label><selectid="baseline-select"name="baseline-choice"><optionvalue="option-1"selected>Select an option</option><hr/><optgrouplabel="Frontend"><optionvalue="html">HTML</option><optionvalue="css">CSS</option><optionvalue="javascript">JavaScript</option></optgroup><optgrouplabel="Web platform"><optionvalue="web-components">Web Components</option><optionvalue="forms">Forms</option></optgroup></select>
Option
Separator
<hr> creates a visual separation between options. Inside <select> it is decorative for assistive technologies.
Group
Option
Educational guide to native select
Choose from options with the browser’s own control
select provides a closed list of options, an accessible name, and form data. Learn what users see, what is selected, and what is submitted without rebuilding its interaction.
1.
Mental model
Label, choice, and data serve different purposes.
1label → id
for identifies the select and gives it a meaningful name.
2option → value
Text explains the choice; value keeps its identifier.
3name → data
The form collects the value of each selected, enabled option.
Static diagram: visible text and the data contract“Professional” can submit plan=pro. Translating the label does not have to change the identifier processed by the server.
id associates the label; name identifies the data. A single select is usually a dropdown; multiple or size greater than one can produce a list box. The browser provides semantics, focus, and selection. Appearance and picker depend on the platform.
2.
Label and submitted value
Keep a visible label and stable values.
for must match a unique id. Each option displays text and supplies its value; omitting value uses its text. Without name, the control contributes no form entry. selected defines the initial selection: after a change, the current state lives in the control, rather than an attribute that is automatically rewritten.
A readable name and a different data value
Professional is initially selected and the data is plan=pro. Change plans: the control keeps its label and selection remains exclusive.
The examples are local forms with no submit button or service destination. You can try the controls without sending data. In your real form, define action/method and validate allowed values on the server; a closed browser list does not prevent tampered requests.
3.
Options, groups, and availability
Group by meaning and explain what cannot be chosen.
optgroup uses label to name a group; its heading is not a selectable option. Groups cannot be nested. disabled on an option prevents choosing it; on optgroup it disables its options. Keep descriptive names instead of relying on gray tones to explain availability.
Groups with a disabled option and a disabled group
CSS belongs to Foundations. WebGPU says “Unavailable” and WebXR is inside a disabled group. Neither destination can be chosen through native interaction.
The playground also supports hr: it adds a visual break, but inside select it is not exposed as a meaningful separator to assistive technologies. It does not replace an optgroup name. Support for hr and for basic select are separate.
4.
required and disabled
An initial instruction should not count as a valid choice.
In a required select without multiple and with display size one, the first option in the list serves as the placeholder label option if its value is empty and it does not belong to an optgroup: keeping it selected does not satisfy required. select has no placeholder attribute. Here it stays enabled so you can return to it; required is enough to reject it during validation.
A required choice and a disabled field
Delivery starts without a valid choice. Standard or Express satisfy required. Region displays EU but is disabled: it receives no focus and is not included in form data.
disabled excludes the control from data and validation; it is not readonly, which select does not support. A selected but disabled option is also omitted from data. Do not disable a field if the server needs its value. If you add custom messages, associate them with the control and show errors when appropriate, without marking the whole page as failed on load.
5.
multiple, size, and keyboard
The number of choices and the number of rows are independent decisions.
multiple allows zero or more options; size sets visible rows, not a selection limit. Without multiple there is only one choice even when size shows several rows. Adding required demands at least one selected option: the dropdown’s special empty-placeholder rule does not carry over to this list.
Several choices versus several rows
Topics starts with HTML and CSS selected. Primary technology shows three rows and allows only one choice. The JavaScript snippet is a data-reading reference; it is not executed in the guide.
Submission repeats the same key: topics=html&topics=css. select.value and FormData.get() return only the first value; use selectedOptions or FormData.getAll() to collect them all. Do not add [] to name unless your server requires it, or convert data with Object.fromEntries if repeated keys must be preserved.
Reach the control with Tab and leave with Tab or Shift+Tab. Arrow keys move through options; typing characters usually searches their text. Opening and confirming the picker varies by system. In desktop multiple lists, Ctrl/Cmd commonly toggles options and Shift extends a range with the pointer; keyboard shortcuts for noncontiguous choices are not uniform. Test your target browser, OS, screen reader, and device without intercepting those keys.
For a small number of multiple choices that should be discoverable without learning modifiers, consider a checkbox group. Do not add role="menu", tabindex on options, or a custom keyboard controller to native select. Changing a choice should not unexpectedly navigate or submit the form.
6.
Choosing a control
Start with the data type and the interaction the person needs.
Native select fits answers that must belong to a closed list. For a few exclusive options, radios expose every choice without opening a picker. Do not use select as a substitute for navigation links.
input with datalist suggests values and permits others that are valid for the input. It does not enforce list membership or guarantee a uniform autocomplete experience. The datalist guide explains its support and accessibility limits.
Customizable select keeps the select element and extends its presentation through pieces such as appearance: base-select and ::picker(select). Support must be assessed separately and a native alternative retained. See its guide for rich HTML, picker, and fallback; these examples do not need it.
field-sizing addresses sizing based on content. It does not change the closed list, submission rules, or keyboard. accent-color is not an API for tinting the whole select either; separate semantics, sizing, and appearance.
7.
Common mistakes
Check association, data, and state before adding logic.
The choice does not reach the server
Expected result
Receive the identifier of the chosen option.
Cause
name is missing, the control has no form association, or the control/option is disabled.
Solution
Check name, the owning form, and disabled; inspect FormData and validate values on the server.
The instruction satisfies required
Expected result
Require a real choice in the dropdown.
Cause
A nonempty value is used, the instruction is inside optgroup, or the special rule is expected with multiple/size greater than one.
Solution
For a one-row required dropdown, use the first direct option with value="". Design list-box and multiple-selection validation separately.
Only one selected topic appears
Expected result
Keep every choice in the data.
Cause
The code reads select.value, FormData.get(), or an object that overwrites repeated keys.
Solution
Use FormData.getAll(name) for submitted values or selectedOptions to inspect current selection.
The name disappears after choosing
Expected result
Understand which data the field requests in every state.
Cause
The first option has been used instead of a visible label.
Solution
Add an associated label using for/id and use aria-describedby for additional instructions.
8.
Support and compatibility
The native foundation does not promise identical pickers across platforms.
Web Platform DX classifies select as Baseline Widely Available. That foundation covers selection, groups, and traditional attributes; it does not automatically establish support for hr, showPicker(), field-sizing, or Customizable select pieces. The Baseline card summarizes compatibility, not an accessibility audit.
These examples use traditional select, option, and optgroup without their own JavaScript. Native selection remains available if copying fails or JavaScript is disabled. Check focus, labels, zoom, forced colors, and the list/picker in real browsers; a desktop screenshot does not establish mobile or assistive-technology behavior.