API / Utilities / FormatNumberOptions
Defined in: src/libs/format-number/types.ts:56
Extends
Properties
| Property | Type | Description |
|---|---|---|
format? |
"number" | "percent" |
Display mode for the numeric value. - 'number' — plain number (default). - 'percent' — value is multiplied by 100 and rendered with a % suffix. Combining 'percent' with units is not meaningful and should be avoided. |
labelMode? |
string |
Internal rendering hint for axis label layout. Not intended for public use. |
lang? |
string |
BCP 47 language tag used for locale-aware formatting (e.g. 'en', 'ru'). Defaults to the application locale when omitted. |
multiplier? |
number |
Factor applied to the value before formatting. For example, multiplier: 1000 converts seconds to milliseconds. |
postfix? |
string |
String appended to the formatted value (e.g. ' USD'). |
precision? |
number | "auto" |
Number of decimal places to display. Use 'auto' to determine precision automatically based on the value magnitude. |
prefix? |
string |
String prepended to the formatted value (e.g. '$'). |
showRankDelimiter? |
boolean |
When true, inserts a thousands separator (e.g. 1 500 000). |
unit? |
null | "auto" | "k" | "m" | "b" | "t" |
Compact unit suffix applied to large numbers. - 'auto' — picks the most appropriate unit automatically (k, m, b, t). - 'k' — thousands (÷ 1 000). - 'm' — millions (÷ 1 000 000). - 'b' — billions (÷ 1 000 000 000). - 't' — trillions (÷ 1 000 000 000 000). - null — no unit suffix. Deprecated Use units for custom scales. This option is fully ignored when units is set. |
units? |
FormatUnitScaleEntry | FormatUnitScale |
Custom unit scale, or a single FormatUnitScaleEntry as sugar for locking every value to one unit (equivalent to the legacy unit: 'k'). When set, fully overrides unit. Unit selection is always automatic: the entry with the largest factor such that ` |
Previous
Next