HTML inputmode global attribute
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since December 2021.
Theinputmodeglobal attribute is anenumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents.This allows a browser to display an appropriate virtual keyboard.
It is used primarily on<input> elements, but is usable on any element incontenteditable mode.
It's important to understand that theinputmode attribute doesn't cause any validity requirements to be enforced on input. To require that input conforms to a particular data type, choose an appropriate<input> element type. For specific guidance on choosing<input> types, see theValue section.
In this article
Value
The attribute can have any of the following values:
noneNo virtual keyboard.For when the page implements its own keyboard input control.
text(default value)Standard input keyboard for the user's current locale.
decimalFractional numeric input keyboard containing the digits and decimal separator for the user's locale (typically. or,).Devices may or may not show a minus key (-).
numericNumeric input keyboard, but only requires the digits 0–9.Devices may or may not show a minus key.
telA telephone keypad input, including the digits 0–9, the asterisk (*), and the pound (#) key.Inputs thatrequire a telephone number should typically use
<input type="tel">instead.searchA virtual keyboard optimized for search input.For instance, thereturn/submit key may be labeled "Search", along with possible other optimizations.Inputs thatrequire a search query should typically use
<input type="search">instead.emailA virtual keyboard optimized for entering email addresses.Typically includes the@character as well as other optimizations.Inputs thatrequire email addresses should typically use
<input type="email">instead.urlA keypad optimized for entering URLs.This may have the/ key more prominent, for example.Enhanced features could include history access and so on.Inputs thatrequire a URL should typically use
<input type="url">instead.
Specifications
| Specification |
|---|
| HTML> # attr-inputmode> |
Browser compatibility
See also
- Allglobal attributes.
enterkeyhintglobal attribute