dash-core-components icon indicating copy to clipboard operation
dash-core-components copied to clipboard

Formatting options for Input components

Open alexcjohnson opened this issue 6 years ago • 5 comments

Various kinds of automatic formatting are common for input fields: thousands separators, parens & hyphens for phone numbers, various ID numbers with dashes interspersed, forcing uppercase or lowercase... would be nice to support these in Input components.

From https://community.plot.ly/t/thousand-separator-for-dcc-input/29563

alexcjohnson avatar Oct 03 '19 22:10 alexcjohnson

I was just looking at this, but was stuck on converting the displayed/masked value back to what presumably you'd want for a callback, which is the "raw" value. The simplest way to do what that user is requesting in JS seems to be to use Intl.NumberFormat.

wbrgss avatar Oct 03 '19 22:10 wbrgss

Also rounding numbers for display but keeping the raw value behind the scenes for callbacks & computations.

chriddyp avatar Oct 15 '19 18:10 chriddyp

I am quite new to this, i studied "Adding CSS & JS and Overriding.." https://dash.plot.ly/external-resources

Could Intl.NumberFormat be used in a .js script that would override the dcc.Input display? If so could you provide a small example? Thanks in advance

barhoom1978 avatar Mar 22 '20 11:03 barhoom1978

Any updates if and when this might become a feature?

charles7276 avatar Mar 10 '23 14:03 charles7276

Not really on our roadmap but we’d happily help advance a PR if anyone is keen to contribute. Please note this repo is not used anymore, DCC is part of the Dash repo now.

alexcjohnson avatar Mar 10 '23 16:03 alexcjohnson