Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Connects an input to a datalist of suggestions. The browser provides autocomplete-style filtering without any JavaScript.
The list attribute connects an <input> to a <datalist> element that provides a set of suggested values. The browser shows these suggestions as a dropdown that filters as the user types. Unlike a <select>, the user can still type a value that is not in the list.
This is the native HTML autocomplete/typeahead — no JavaScript required for the basic behavior.
Applies to: <input> (most types)
| Component | Purpose |
|---|---|
list="id" on input | Points to the <datalist> by its id |
<datalist id="id"> | Contains <option> elements with suggested values |
<option value="..."> | Each suggestion. The value is what gets filled in. |
The simplest pattern: a text input with a list of suggestions. The browser filters options as the user types, matching against the value attribute.
<label for="fruit">Favorite Fruit</label><input type="text" id="fruit" name="fruit" list="fruit-options" /> <datalist id="fruit-options"> <option value="Apple" /> <option value="Banana" /> <option value="Cherry" /> <option value="Grape" /> <option value="Mango" /> <option value="Orange" /> <option value="Peach" /> <option value="Strawberry" /></datalist>
The user can select from the list or type any value they want. The list is a suggestion, not a constraint.
Options can have inner text that serves as a visible label. The value attribute is what gets submitted. Some browsers show both the label and value in the dropdown.
<label for="browser">Browser</label><input type="text" id="browser" name="browser" list="browsers" /> <datalist id="browsers"> <option value="chrome">Google Chrome</option> <option value="firefox">Mozilla Firefox</option> <option value="safari">Apple Safari</option> <option value="edge">Microsoft Edge</option></datalist><!-- The inner text is shown as a label; the value is submitted -->
On type="email", the datalist provides email address suggestions. This is useful for fields where the user frequently enters the same addresses.
<label for="contact-email">Email</label><input type="email" id="contact-email" name="email" list="email-suggestions" /> <datalist id="email-suggestions"> <option value="[email protected]" /> <option value="[email protected]" /> <option value="[email protected]" /></datalist>
On type="url", the datalist can suggest common URLs. The browser still validates that the final value is a valid URL.
<label for="website">Website</label><input type="url" id="website" name="url" list="url-suggestions" placeholder="https://..." /> <datalist id="url-suggestions"> <option value="https://github.com" /> <option value="https://stackoverflow.com" /> <option value="https://developer.mozilla.org" /></datalist>
On type="number", the datalist suggests specific numeric values. The user can still type any number within the min/max range.
<label for="rating">Rating (1-10)</label><input type="number" id="rating" name="rating" min="1" max="10" list="rating-options" /> <datalist id="rating-options"> <option value="1" /> <option value="5" /> <option value="10" /></datalist>
On type="range", the datalist creates visible tick marks on the slider track. The label attribute on options may be displayed as tick labels (browser support varies).
<label for="volume">Volume</label><input type="range" id="volume" name="volume" min="0" max="100" step="1" list="volume-ticks" /> <datalist id="volume-ticks"> <option value="0" label="Mute" /> <option value="25" label="Low" /> <option value="50" label="Medium" /> <option value="75" label="High" /> <option value="100" label="Max" /></datalist>
This is one of the most underused native features. Tick marks turn a plain slider into a meaningful control with visible reference points — no JavaScript needed.
Populate the datalist dynamically with JavaScript for server-driven autocomplete. The browser automatically picks up new options added to the datalist.
<label for="city">City</label><input type="text" id="city" name="city" list="city-suggestions" /><datalist id="city-suggestions"></datalist>
const input = document.querySelector('#city');const datalist = document.querySelector('#city-suggestions'); input.addEventListener('input', async () => { if (input.value.length < 2) return; const response = await fetch(`/api/cities?q=${input.value}`); const cities = await response.json(); datalist.innerHTML = cities .map(city => `<option value="${city.name}" />`) .join('');});
<label>. Always provide a visible label for the input.<select> when the user must pick from a fixed set.list attribute does not work on type="hidden", type="password", type="checkbox", type="radio", type="file", or type="image".input or change events on the input itself.autocomplete — browser autofill for personal datamultiple — accept multiple values in one field<select> — constrained choice from a fixed set<input> element reference