Controls and the structure around them. Buttons, fields, selects, labels and fieldsets are styled with no class, and so are output, meter and progress. A .luz-* class adds a role, a size or the parts a bare element cannot say.
Styled by elements/forms.css, with no class. A button with no type, or with type="submit", is the primary action; type="button" and type="reset" are the secondary one. Add .luz-btn to an a that must look like a button, and for the danger and ghost roles and the sizes.
Styled by elements/forms.css, with no class: a box with the legend on its edge. A label that holds a radio button or a checkbox puts it beside the text. The component classes .luz-check-group and .luz-check-item draw the box and the dot themselves.
A form has no style of its own: it is structure. The controls inside it carry the look, and the space between them comes from their own rules. Leave Name empty and press Send: the browser stops the submit and says why.
Styled by elements/forms.css, with no class: text, email, number, date and the other text types fill their container. Add .luz-input to a color or file input, and .luz-field to a label with a help text and an error.
Use it for the result of a calculation or of an action, tied to the controls that produced it with for. Its value is not submitted with the form. Widely available since October 2018.
Screen readers: MDN: many browsers implement it as a live region, so a change is announced without moving focus. Updates are announced as plain text: a link or a button inside it may not be conveyed.
Styled by elements/forms.css, with no class: the closed box. The open list is the browser’s. Add .luz-select to style the open list too, where the browser can.
Repeats the chosen option inside the button of a customizable select, so its icons and formatting carry over. Experimental: check the browser compatibility table on MDN before you rely on it.
Styled by elements/forms.css, with no class: the look of a text field, taller, and it grows vertically only. The classes .luz-input and .luz-input--textarea give the same look inside a .luz-field.
The 22 input types
One element, <input>, becomes a different control with its type. Each has a live example with no class, except color and file, which take .luz-input; hidden and image have nothing to show. The browser validates and offers the right keyboard on its own: pick the most specific type before reaching for a script.
type="button"
A push button with no behaviour of its own: a script gives it one. Prefer the button element, which can hold markup.
type="checkbox"
On or off, or one of several choices that can all be on.
type="color"
Opens the browser’s color picker. The value is always #rrggbb.
type="date"
A day: year, month and day. The value is YYYY-MM-DD whatever the display language.
type="datetime-local"
A day and a time with no time zone.
type="email"
One address, or several with multiple. The browser checks the shape and shows an @ on a phone keyboard.
type="file"
Chooses files from the device. accept filters them, multiple allows several.
type="hidden"
Not shown: its value travels with the form. Never put anything secret in it, the reader can read it.
Nothing to show here.
type="image"
A submit button drawn as an image. It needs src and alt. Prefer a button that holds an img.
Nothing to show here.
type="month"
A year and a month. Firefox and Safari on a computer show a text field: write YYYY-MM, and add a pattern.
type="number"
A number with steps: min, max and step. For a postal code or a card number use inputmode="numeric" on a text field instead.
type="password"
Hides the characters. Set autocomplete to current-password or new-password so a password manager can help.
type="radio"
One choice among several that share a name.
type="range"
A slider between min and max. It does not show its value: pair it with an output.
type="reset"
Puts the fields of its form back to their first values. Rarely wanted: it is easy to press by mistake.
type="search"
A search term. Some browsers add a button to clear it.
type="submit"
Sends its form. Without a form it does nothing.
type="tel"
A phone number. The browser checks no format, and shows a keypad on a phone.
type="text"
The default: one line of free text.
type="time"
A time of day with no date.
type="url"
One absolute address, checked by the browser.
type="week"
A year and an ISO week. Firefox and Safari on a computer show a text field: write YYYY-Www, and add a pattern.