Add a leading 0 when input value is .00 using react-imask

How can I add a leading 0 when the input value is .00. For example I will enter a value of .99 and it will automatically append 0.99 and if I enter a whole number it will append .00, for example I will enter 50 then i will automatically append 50.00.

I tried mask=“00.00” but this will accept only 2 digits number.

Hey, are you using node if so here is a link that might help.

react-imask - npm (

Hi @robheyays , thanks for your answer. Yes im using that library. However, i need the pattern on how to achieve that. Thanks

The search I did on the web came back with an entire new funtionJS for the leading 0.00 issue, right now I assume your changing your exisisting code. I hope this helps.

are you consulting the documentation on this library?

Thanks for this resource @ilenia . I manage to solve the pattern. I use the below pattern to achieve what i want.


This actually accept billion digits of number and enforce 0 if the value is float.

If I enter .99 it will enforce 0.99.