Form
Number input
Published on
Description
The number input accepts numeric values. It includes browser-provided increment/decrement controls and restricts input to digits on mobile keyboards.
Example
Accessibility
- Use explicit
<label for="id">association. - Inherit typography for WCAG 1.4.12 compliance.
- The increment/decrement spinner buttons can be difficult for some users. Consider a plain text input with
inputmode="numeric"andpattern="[0-9]*"for simpler numeric entry. - Associate min, max, and step constraints via hint text using
aria-describedby.
References
- Under-Engineered Text Boxen (opens in new tab) — Adrian Roselli
- My Priority of Methods for Labeling a Control (opens in new tab) — Adrian Roselli
Related
- Text input — for general text entry
Variables
None for input