Skip to content
Web Design & Development

How to Get HTML Input Types Right

The built-in form field types, such as email, tel, number, date and search, and the behavior browsers attach to them.

MediaScaleUp Editorial Team 2 min read 11 views
How to Get HTML Input Types Right

What is at stake

The right input type gives mobile users the right keyboard, free validation and better autofill, with no extra code.

The playbook

  1. Use the most specific input type
  2. Add inputmode where the keyboard matters
  3. Combine types with autocomplete attributes
  4. Test native pickers on mobile
  5. Keep server-side validation regardless

Where it goes wrong

Avoid:

  • Text inputs for numbers and emails
  • Custom pickers that replace working native ones
  • Client-side validation as the only check
  • Blocking valid formats such as international phone numbers
What to do and what to avoid with HTML input types, side by side
Good practice against the usual mistakes, from the sources listed below.

The numbers behind it

Published figures for HTML Input Types
MeasureFigure
Keyboardsmobile browsers show different keyboards per type
Validationtypes such as email provide built-in checks
Date inputsbrowsers supply native date pickers
Fallbacksunsupported types fall back to text

Getting outside help

When to hand it over: Bring in help when forms cause high abandonment on mobile.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development