HTML reference

inputmode

The inputmode attribute hints which virtual keyboard a mobile device should show. It improves typing convenience, but it does not restrict or validate the value.

What you will learn

  • What keyboard hint inputmode provides
  • How it differs from type
  • How to combine convenience with real validation

Basic examples

<label for="pin">PIN</label>
<input id="pin" name="pin" type="text" inputmode="numeric" autocomplete="one-time-code">

<label for="email">Email</label>
<input id="email" name="email" type="email" inputmode="email">

inputmode is a hint

Values such as numeric, decimal, email, tel, and url can guide the keyboard. A browser or device may ignore the hint, and users can still enter unexpected characters.

inputmode and type

type describes the control and can enable built-in validation or specialized behavior. inputmode only suggests the keyboard. Choose the correct type where it matches the data, and validate on the server.

Related pages