Skip to main content

html-tags.com

<input>

The shape-shifting form control: 22 types from text to color to file.

Baseline: Widely available · Forms

When to use it

Pick the specific type (email, url, tel, date, number, range, search…) — each brings validation, the right mobile keyboard, and the right widget; add autocomplete tokens.

When not to

Don't use type='text' for typed data, and don't suppress native validation only to rebuild it worse in JS.

Key attributes

type
the control kind
name
submission key
required / min / max / step / pattern / maxlength
constraints
autocomplete
standard fill tokens
inputmode / enterkeyhint
virtual keyboard hints
list
datalist id

Example

<label for='qty'>Quantity</label>
<input type='number' id='qty' name='qty' min='1' max='10' value='1' required>
Rendered live above, source below.

Authoritative references