currency Renderer
renderAs: 'currency' renders a numeric value as a locale-aware formatted currency amount using Intl.NumberFormat. Supports colorization, compact notation, and parenthetical negative formatting.
Core Examples
Basic Currency
Budget as plain USD. Spend with colorize: true — negative red, positive green.
{ key: 'budget', renderAs: 'currency', renderAsOptions: { locale: 'en-US', currency: 'USD' } }
{ key: 'spend', renderAs: 'currency', renderAsOptions: { locale: 'en-US', currency: 'USD', colorize: true } }
Locale and Currency Code
Pass any BCP 47 locale and ISO 4217 currency code. The symbol position and decimal separator adapt automatically.
Same value formatted as USD, EUR, and GBP with their respective locales.
{ renderAsOptions: { locale: 'en-US', currency: 'USD' } } // $4,200.00
{ renderAsOptions: { locale: 'de-DE', currency: 'EUR' } } // 4.200,00 €
{ renderAsOptions: { locale: 'en-GB', currency: 'GBP' } } // £4,200.00
Compact Notation
compact: true switches to compact notation when the value meets compactThreshold (default: 1,000,000). Set a lower threshold to compact smaller values.
Revenue in full format vs compact notation (threshold set to 1000 for demonstration).
{ renderAsOptions: { locale: 'en-US', currency: 'USD', compact: true, compactThreshold: 1000 } }
// → $1.42M
Negative Format
negativeFormat: 'parentheses' wraps negative values in (parens) — standard accounting notation.
Negative delta shown with minus sign vs accounting parentheses. Colorize applied to both.
{ renderAsOptions: { colorize: true, negativeFormat: 'minus' } } // -$1,250.00
{ renderAsOptions: { colorize: true, negativeFormat: 'parentheses' } } // ($1,250.00)
Options Reference
| Option | Type | Default | Effect |
|---|---|---|---|
currency | string | 'USD' | ISO 4217 currency code. |
locale | string | 'en-US' | BCP 47 locale for number formatting. |
minimumFractionDigits | number | 2 | Minimum decimal places. |
maximumFractionDigits | number | 2 | Maximum decimal places. |
showSymbol | boolean | true | Show the currency symbol. |
symbolPosition | 'prefix' | 'suffix' | locale default | Override symbol position. |
compact | boolean | false | Use compact notation (K, M, B) when value reaches compactThreshold. |
compactThreshold | number | 1000000 | Minimum absolute value to trigger compact notation. |
colorize | boolean | false | Color positive values green, negative red, zero neutral. |
positiveColor | string | theme green | Override for positive values. |
negativeColor | string | theme red | Override for negative values. |
zeroColor | string | theme neutral | Override for zero values. |
negativeFormat | 'minus' | 'parentheses' | 'minus' | How to display negative values. |
decimalAlign | boolean | false | Aligns decimal points vertically in table columns. |
className | string | unset | Additional CSS class on the root element. |
Caveats
- Non-numeric values and
NaNrender'Invalid'. compactusesIntl.NumberFormatnotation: 'compact'— output depends on locale (e.g.1.4Minen-US,1,4 Mio.inde-DE).decimalAlignuses CSSchunits — reliable in monospace columns but may drift in proportional fonts.
See Also
- deltaValue Renderer — signed directional change values
- number Field Type
- Field Config