Skip to content

inputmode attribute

An HTML attribute on form inputs that tells mobile browsers which on-screen keyboard layout to show -- numeric pad, telephone dialpad, email keyboard, etc.

The inputmode attribute on <input> and <textarea> is a hint to mobile browsers about which on-screen keyboard layout to show when the field receives focus. Without it, users see the default text keyboard and have to mode-switch -- 2-3 extra taps per phone-number, OTP, or numeric-ID field.

Defined values:

  • none -- no keyboard (use a custom input UI)
  • text -- standard text keyboard (the default)
  • decimal -- numeric keypad with . (or locale equivalent)
  • numeric -- digits-only keypad
  • tel -- telephone keypad with *, #, etc.
  • search -- text keyboard with a "Go" / "Search" return key
  • email -- text keyboard with @ and . quick-access
  • url -- text keyboard with / and .com quick-access

inputmode complements but doesn't replace type=:

  • type="email" and type="tel" already trigger appropriate keyboards on most browsers, but cross-browser consistency is poor; inputmode makes the choice explicit.
  • One-time-code fields and PIN entries are typically <input type="text" inputmode="numeric" autocomplete="one-time-code"> -- type=text because the native validation isn't useful, inputmode=numeric for the right keyboard.

Performance / UX impact: small per-field but cumulative -- saving 2 taps × 5 numeric fields × hundreds of users / day adds up to material time savings. Especially noticeable on mobile checkout flows.

Related terms

Further reading

Send Feedback