NumberFormat
Data Display
stable
Locale-aware number, currency and percentage formatter.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- valuerequisnumber | 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
Emplacements de contenu exposés par ce composant.
- #default
- Custom render override. Receives the formatted string, Intl parts, and numeric value.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Format variants
Locale & grouping
Custom slot