Skip to content
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

How can we set thousand separator input number? #1025

Open
vuvikingit opened this issue Jan 19, 2024 · 3 comments
Open

How can we set thousand separator input number? #1025

vuvikingit opened this issue Jan 19, 2024 · 3 comments
Assignees
Milestone

Comments

@vuvikingit
Copy link

vuvikingit commented Jan 19, 2024

I want the input data to be of numeric type, but automatically display on UI with thousand separators.
How can I set ?

Screenshot 2024-01-19 at 17 39 45

@ukrbublik ukrbublik added the MUI label Jun 7, 2024
@ukrbublik ukrbublik added this to the UI improve milestone Jun 7, 2024
@mahtabhnp
Copy link

Hi,
I’m interested in working on this issue. Could you please assign it to me? This will be my first contribution, and I’m excited to get started. Let me know if there are any specific guidelines or steps I should follow.

Thank you!
@ukrbublik

@mahtabhnp
Copy link

Hi @ukrbublik ,

I’m currently working on the task to add a thousand separator to the numeric input, but I was hoping you could clarify or provide more details about a few points that are a bit unclear:
Should the thousand separator also support decimal points (e.g., 1,234.56)?
How should the input behave when users are typing numbers? Should they see the formatted number immediately, or only after they finish typing?
When sending data to the backend, should the number be in a raw format (without separators) or formatted?
Is there any specific library or approach you recommend for implementing this (e.g., Intl.NumberFormat, numeral.js)? Or should it be done manually?
Does this input need to support localization for different regions (e.g., commas vs periods for thousand separators)?
Let me know if you can provide additional details or examples to help ensure the implementation meets expectations. Thanks in advance for your guidance!

@ukrbublik
Copy link
Owner

On backend it should be always number not string.

Should they see the formatted number immediately, or only after they finish typing?

I think yes, immediately

Please consider using react-number-format as in example:
https://mui.com/material-ui/react-text-field/#integration-with-3rd-party-input-libraries

I think props like

thousandsGroupStyle="lakh"
  thousandSeparator=","

(And others maybe like prefix, suffix)
should go to fieldSettings to be configurable by user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants