Open J-Sek opened 5 months ago
We could take some inspiration from PrimeVue's InputNumber. However their API binds itself strongly to Intl.NumberFormat`. We could deliver better DX with:
false
)0
) – to handle both min and max as I don't see the reason for splitIntl.NumberFormatOptions
– total flexibility without polluting component's APIEdit: I will not continue subject of grouping/formatting in this issue in order to keep it focused on precision and hopefully get it done faster.
Problem to solve
In my large web app I have multiple forms with many different use cases for number inputs. When I want user to put a value in USD it should display nicely using expected formatting and enforce up to 2 decimal digits. Having "$" prefix is OK, but actually formatting and enforcing precision is a level-up in terms of UX.
Playground
Proposed solution
precision
blur
event should cut off unnecessary characters (it would be great to never emit them to the parent component)Simplified implementation:
I think implementation would require additional props for grouping character and decimal separator.
Related to:
11495 (rejected in 2020)
18060 (
vue-currency-input
supports onlyv-text-field
and I personally find it cumbersome and compromising on UX)19450 (I don't think
maska
is a good fit... and again, I would need to recreate VNumberInput's controls)