Currency
Format numeric values as currency
Currency
The currency formatter renders a numeric value with thousands grouping and a configurable symbol and decimals.
Options
| Option | Type | Default | Description |
|---|---|---|---|
symbol | string | "$" | Currency symbol, e.g. "€", "₹" |
decimals | number | 2 | Number of decimal places |
group | string | "," | Thousands separator |
decimal | string | "." | Decimal separator |
Usage
validationSchema: {
price: { format: { type: "currency", trigger: "onBlur" } },
}Result
| Input | Result |
|---|---|
12345.67 | $12,345.67 |
Things to know
- Currency is usually formatted on
"onBlur"— typing a formatted value is jarring. - Pair with the
decimalornumericvalidator for validation.