Do not display 0 #3434
-
How to make the input have the initial value 0, type "number", but nothing would be displayed in the input itself (so that the placeholder would be visible)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Number inputs should be typed A user might actually input "0", so that should generally be distinguishable from an empty input, plus an input populated with 0 makes it harder to enter the first number (you cannot click the input and type "1", you must double click it or press delete and then type 1). If you're accepting "" and want it cast to 0, you can do something like:
|
Beta Was this translation helpful? Give feedback.
Number inputs should be typed
"" | number
. That is, empty should be a possible value (whether or not it validates is another question).A user might actually input "0", so that should generally be distinguishable from an empty input, plus an input populated with 0 makes it harder to enter the first number (you cannot click the input and type "1", you must double click it or press delete and then type 1).
If you're accepting "" and want it cast to 0, you can do something like: