Name
number
Type
_input
Synopsis
How to render a number only input field
Description
elements of type "number"
are used to let the user enter a number. They include built-in validation to reject non-numerical entries. The browser may opt to provide stepper arrows to let the user increase and decrease the value using their mouse or by simply tapping with a fingertip.
By default, the up and down buttons provided for you to step the number up and down will step the value up and down by 1. You can change this by providing a step
attribute, which takes as its value a number specifying the step amount.
You can use the min
and max
attributes to specify a minimum and maximum value that the field can have.
Parameters
_input type="number"
Example
This example accepts only a value between 0 and 10 with steps of 0.01 (e.g. 2.21)
<_input type="number" placeholder="1.0" step="0.01" min="0" max="10" />
Note
Links
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number