0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Lets a select, an email input or a file input hold more than one value. Covers select size, the email list format and how each control submits its values.
Overview
multiple is a boolean attribute that lets a control accept more than one value. It means something different on each element: a listbox where several options can be selected, an email field that takes a comma-separated list, or a file picker that returns several files.
<form-field><labelfor="langs">Languages you speak</label><selectid="langs"name="languages"multiplesize="5"><optionvalue="en"selected>English</option><optionvalue="es">Spanish</option><optionvalue="fr">French</option><optionvalue="ja">Japanese</option><optionvalue="sw">Swahili</option></select></form-field><form-field><labelfor="invite">Invite teammates</label><inputtype="email"id="invite"name="invite"multiple /><outputclass="hint"for="invite">Separate addresses with commas.</output></form-field><form-field><labelfor="photos">Photos</label><inputtype="file"id="photos"name="photos"multipleaccept="image/*"data-upload /></form-field>
Values
Boolean: present allows several values; multiple="false" still does. Remove the attribute for a single value.
Element
With multiple
Submitted as
Read in script
<select>
A listbox; any number of options selected
One name=value pair per selected option
select.selectedOptions, formData.getAll(name)
type="email"
A comma-separated list, each address validated
One pair; the addresses joined by commas with no spaces
input.value.split(',')
type="file"
The picker allows several files
One pair per file
input.files, formData.getAll(name)
size on <select>
size sets how many rows a select shows. A select renders as a listbox when it has multiple or a size above 1; otherwise it is a dropdown. The default display size is 4 with multiple and 1 without.
<form-field><labelfor="to">To</label><inputtype="email"id="to"name="to"multipleautocomplete="off"data-message-typemismatch="Separate addresses with commas, and check each one." /><outputclass="hint"for="to">Separate addresses with commas.</output><outputclass="error"for="to"aria-live="polite"></output></form-field>
"Pick between N and M": checkboxes, not a listbox
A multi-select listbox needs modifier keys to add a second option, and one plain click clears the rest. For a handful of options, checkboxes are clearer, and a data-validate form can count them.
One or two days
<formdata-validate><fieldsetdata-min-checked="1"data-max-checked="2"><legend>Pick one or two delivery days</legend><label><inputtype="checkbox"name="days"value="mon" /> Monday</label><label><inputtype="checkbox"name="days"value="wed" /> Wednesday</label><label><inputtype="checkbox"name="days"value="fri" /> Friday</label><outputclass="error"aria-live="polite"></output></fieldset><buttontype="submit">Save</button></form>
Select styling. The dropdown chevron and the customizable-select enhancement (appearance: base-select) apply only to single-row selects: no multiple, and size absent, 0 or 1 (src/native-elements/input/styles.css, src/native-elements/input/select.css). A multiple or size greater than 1 select keeps the native listbox, so its options stay scrollable.
data-upload turns a file input into a drop zone with a file list. Dropped files go through the same rules as the picker: without multiple only the first is kept (and the user is told), and files that don't match accept are named and left out (src/utils/upload-init.js). A new pick or drop replaces the selection; files are not accumulated.
Checkbox groups.fieldset[data-min-checked] / [data-max-checked] in a data-validate form, data-select-all for a master checkbox, and data-toggle-tags for tag-style choices.
Components.<combo-box> has a multiple mode that shows selected items as tags, for long or searchable lists.
Accessibility
A <select multiple> is a listbox. Mouse users add options with Ctrl or Cmd + click and ranges with Shift + click; keyboard users extend with Shift + arrow keys, and adding a single non-adjacent option by keyboard differs by platform. Many users know none of this, so explain it in a hint, or use checkboxes.
For an email list, say how to separate addresses in visible hint text; the format is not obvious.
data-upload adds a named list of the files and announces rejected files in a status line.
Browser support
multiple works everywhere. Safari on iOS ignores size and shows a select as a picker; Chrome for Android honours size from version 142.
Gotchas
formData.get() returns only the first value. Use getAll() for multiple selects and files.
required on <select multiple> means at least one option. There is no native "at least two".
Opening the file picker again replaces the earlier selection rather than adding to it.