How do you design for numbers that might be 3 or 3,000,000?
Stat cards look great in the mockup with "128" in them. Then real data shows up and someone has 14,302,991 followers and the card wraps onto two lines.
Things I've tried: compact formatting (14.3M) with the full value in a tooltip, tabular figures so columns line up, and setting a min-width based on the worst realistic case rather than the average.
What's your approach for wildly varying number lengths in dashboards and cards? Do you abbreviate everywhere or only in tight spaces?
Comments · 3
Use Intl.NumberFormat with notation: "compact" and it handles locales for you. Writing your own abbreviations breaks in languages with different grouping rules.
Test with absurd data early. I put 99999999 and a long name in every card of my first project and found three layout bugs in ten minutes.
For financial figures, don't round away detail people need. Compact is fine for dashboards, but exact values must be one tap away, and always show the currency.