Data
Amount
One way to show money across an app, so every screen formats alike and columns line up: mono, tabular figures, the real minus sign. The currency symbol takes the muted ink, so the number reads first. With a tone the sign always shows, since color only reinforces it. Set the locale and currency once on a FormatProvider.
Preview
the same amount, four currencies
R$ 1.234,561.234,56 €$1,234.56¥1,234
tone, always with a sign
+$45.00−$45.00$0.00
compact, the full value on hover
R$ 1.100,00$1,234,567.89
a large value with muted cents
$23,500.00
tabular figures line up
- rent−$1,800.00
- client invoice+$9,500.00
- coffee−$12.50
- refund+$89.90
Installation
// Resolves dependencies, copies the source, and installs npm packages automatically.
Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | - | Integer minor units: 123456 is 1,234.56 in a currency with cents |
| currency / locale | string | - | Fall back to the FormatProvider's. A currency is required somewhere |
| tone | "auto" | "neutral" | "positive" | "negative" | "neutral" | auto colors by the sign. Any tone but neutral also shows the sign |
| signDisplay | "auto" | "always" | "never" | - | always with a tone, auto without one |
| compact | boolean | false | 1.2K, for axes and small widgets. Screen readers and hover get the full value |
| muteCents | boolean | false | Cents in the muted ink, for a large value |