-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[number field] Support decimal values #41
Comments
One way that I found to make this work is implementing the <NumberInput
aria-label="Demo number input"
placeholder="Type a number…"
value={Math.round(value * 10) / 10}
step={0.1}
onChange={(event, val) => setValue(val)}
/> It's not the most elegant solution as it adds processing time after the fact but it's one way of forcing it to be a decimal with the correct formatting. |
Hey @AarCon, we've shipped a new alpha NumberField component which supports decimal values, alongside a few other cool features. Check it out and let us know what you think! https://base-ui.netlify.app/base-ui/react-number-field/ |
Closing the issue as we support decimal values in the new NumberField. |
hey @michaldudak , can you share the release this was published in? I'm looking to add number input to my platform. |
We released the NumberField in @base_ui/[email protected]. Note that it's an alpha release and we still may introduce breaking changes. |
Hey @michaldudak , first of thank you for all the work, the base ui helps a lot in my project and you guys have saved me a lot of work. |
That's right, it's not available in @mui/base. |
This feature request was raised in [base-ui] Create useNumberInput and NumberInput material-ui#36119 (comment). It requires [useNumberInput] Warn when switching between controlled and uncontrolled state material-ui#38514 to be implemented first.
The handling of the
step
that is not an integer is broken. e.g. open https://mui.com/base-ui/react-number-input/#componentScreen.Recording.2023-10-03.at.01.33.46.mov
Benchmarks
The text was updated successfully, but these errors were encountered: