NumberFormat
Data Display
stable
Locale-aware number, currency and percentage formatter.
API
Props
All props accepted by this component, with their type, default value and description.
- valuerequirednumber | string
- Number to format and render. String values are coerced via Number().
- formatTNumberFormatFormat'decimal'
- High-level format dialect controlling how the number is rendered.
- localeTNumberFormatLocale'auto'
- BCP-47 locale tag or 'auto' to resolve from the document or navigator.
- currencystring'USD'
- ISO 4217 currency code. Required when format === 'currency'.
- currencyDisplayTNumberFormatCurrencyDisplay'symbol'
- Controls how the currency symbol is rendered ($, USD, US dollar…).
- unitstring
- ECMAScript-sanctioned unit identifier (e.g. 'kilometer-per-hour'). Required when format === 'unit'.
- unitDisplayTNumberFormatUnitDisplay'short'
- Unit label verbosity (short: km/h, long: kilometers per hour, narrow: kph).
- notationTNumberFormatNotation
- Raw notation override for Intl.NumberFormat. Auto-set from format when relevant.
- compactDisplayTNumberFormatCompactDisplay'short'
- Compact notation display: 'short' (1M) or 'long' (1 million). Only when notation='compact'.
- minimumFractionDigitsnumber
- Minimum digits after the decimal point.
- maximumFractionDigitsnumber
- Maximum digits after the decimal point.
- minimumSignificantDigitsnumber
- Minimum significant digits. Mutually exclusive with fraction digit props.
- maximumSignificantDigitsnumber
- Maximum significant digits. Mutually exclusive with fraction digit props.
- useGroupingTNumberFormatUseGroupingtrue
- Thousands-separator behaviour. true/'auto' = locale default, false = none, 'always' forces separators, 'min2' only when ≥2 groups.
- signDisplayTNumberFormatSignDisplay'auto'
- Sign display strategy. 'auto' = only negatives get the sign.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'span'
- HTML element rendered at the root. Defaults to span.
API
Slots
Content slots exposed by this component.
- #default
- Custom render override. Receives the formatted string, Intl parts, and numeric value.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Format variants
Locale & grouping
Custom slot