react-number-format
react-number-format copied to clipboard
Add support for type 'number'
I.e. so the input type = 'number'
Allowing the number keyboard to show on mobile:
I would also like this!
However word of caution setting type="number" might cause a lot of problems. See: http://bradfrost.com/blog/post/you-probably-dont-need-input-typenumber/
Setting inputmode for modern browser and falling back to the pattern attribute would show a number keyboard on mobile devices without the usability issues of type="number"
Is there any progress on supporting type="number?
type='tel'
Seems to have such side effects.
@redblue9771 type='tel'
does not include a decimal on the keyboard on iOS Safari.
This is essential for an input formatting library.
If input number types are supported so are their attributes, min
and max
being especially useful in the case where the library doesn't provide these forms of validation as a feature.
Rejection of non-numeric numbers are built-in as well, browsers may also provide stepper arrows for incremental inputs.
Another problem with the number type I stumbled upon is the behavior in FF. When the type is number, you can type in non numeric characters, but then just about nothing happens. So, you get ugly things like:

To get a different keyboard without changing the type you can use the inputMode
attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode
@R4VANG3R there is no [inputmode]
that works like type='number'
keyboard on iOS https://codepen.io/Grawl/pen/RwpEKzQ
decimal
have ,
button but I want .
button
UncaughtTypeError
This please! If type="number" is not supported. Is there a workaround to be able to use the text field with min/max validations? 🤔 I'm using this field in a form and only want to allow values greater than 0. The isAllowed
prop is not robust enough and seems to be causing issues.
UncaughtTypeError
This please! If type="number" is not supported. Is there a workaround to be able to use the text field with min/max validations? 🤔 I'm using this field in a form and only want to allow values greater than 0. The
isAllowed
prop is not robust enough and seems to be causing issues.
Could you elaborate on the issues you experienced with isAllowed
?