The <datalist> element holds a set of <option> suggestions for another control — usually an <input>.
Give the list an id, then set the input’s list attribute to that same id. Users can pick a suggestion or type a different valid value. It is not a drop-in replacement for <select>.
Limited availability (not full Baseline).
Widely useful in modern browsers, but support and UI details vary by input type. Always test critical forms.
Accessibility caution.
Suggestion popups may not zoom with page zoom, are hard to restyle for high contrast, and some screen reader/browser pairs do not announce options well (MDN).
Both start and end tags are required. Put zero or more <option> children (or phrasing content). The control that receives suggestions is separate from the list itself.
Reference
Attributes
<datalist> has no tag-specific attributes beyond globals. The wiring that matters:
datalist: recommends values; other input is still allowed.
select: the control is the list of allowed choices.
Pick by product need. Open answers → datalist; closed set → select.
Do not fake a select with datalist if only listed values are valid — validate on the server too.
Edge Cases & Pitfalls
Most bugs are mismatched ids, treating datalist like select, or assuming identical UI everywhere.
wiring
id and list must match
If list does not equal the datalist id, suggestions never appear.
semantics
Not a select replacement
Users can enter values outside the list. Use <select> (plus server checks) for a closed set.
a11y
Assistive tech gaps
Some combinations do not announce the popup; option text may not zoom. Label inputs clearly and test.
css
Limited styling
You cannot reliably theme the native suggestion menu. Expect the browser’s default UI.
types
Support varies by input type
Text-like types are the common case. Range ticks, color swatches, and date UIs differ across browsers.
Compatibility
Browser Support
The <datalist> element is standard HTML, but MDN marks it limited availability because behavior is not identical everywhere.
✓ Limited availability
<datalist>
Supported in modern Chrome, Firefox, Safari, Edge, and Opera for common text-like inputs. Exact menus, range ticks, and color presets vary. Internet Explorer had partial support only.
92%Global support (approx.)
Google Chrome20+
Supported
Mozilla Firefox4+
Supported
Apple Safari12.1+
Supported
Microsoft Edge12+
Supported
Opera9.5+
Supported
Samsung InternetAll
Supported
Internet Explorer10*
Partial
<datalist>Broad modern support
Bottom line: Fine for progressive enhancement. Do not rely on datalist alone for required closed choices or critical accessibility without testing.
Remember
Key Takeaways
Role: optional suggestions for an input, not a locked choice list.
Wire:list on input = id on <datalist>.
Options: each suggestion needs a value the input can accept.
Choose carefully: closed sets belong in <select>; test a11y and input types.
One line:<datalist> suggests values for an <input list="…"> — it does not force them.
UA style
Default CSS Settings
The datalist itself is not shown as page content; the browser draws the suggestion UI. Typical author CSS cannot restyle that popup.
default.css
datalist {
display: none; /* suggestions appear via the bound control's UI */
}
Style the associated <input> (and its label) as usual; leave the native list UI to the browser.
Frequently Asked Questions
The datalist element holds option suggestions for another control, usually an input. Link them with matching id on datalist and list on the input.
No. select forces a choice from a fixed list. datalist only suggests values; the user can still type something else that passes validation.
Commonly text, search, url, tel, email, and number show a suggestion menu. date/time types, range (tick marks), and color can also use predefined options, with varying UI by browser.
No tag-specific attributes beyond the global attributes. The important hook is id, which must match the input list attribute.
Browser UI for the popup is largely unstyled. You cannot reliably theme it like a custom select; plan for native look and limited CSS control.
Support and announcements vary. Some screen reader and browser pairs do not announce suggestions well, and option text may not zoom with page zoom. Prefer clear labels and test with assistive tech.