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.

value
requis
number | string
Number to format and render. String values are coerced via Number().
format
TNumberFormatFormat
'decimal'
High-level format dialect controlling how the number is rendered.
locale
TNumberFormatLocale
'auto'
BCP-47 locale tag or 'auto' to resolve from the document or navigator.
currency
string
'USD'
ISO 4217 currency code. Required when format === 'currency'.
currencyDisplay
TNumberFormatCurrencyDisplay
'symbol'
Controls how the currency symbol is rendered ($, USD, US dollar…).
unit
string
ECMAScript-sanctioned unit identifier (e.g. 'kilometer-per-hour'). Required when format === 'unit'.
unitDisplay
TNumberFormatUnitDisplay
'short'
Unit label verbosity (short: km/h, long: kilometers per hour, narrow: kph).
notation
TNumberFormatNotation
Raw notation override for Intl.NumberFormat. Auto-set from format when relevant.
compactDisplay
TNumberFormatCompactDisplay
'short'
Compact notation display: 'short' (1M) or 'long' (1 million). Only when notation='compact'.
minimumFractionDigits
number
Minimum digits after the decimal point.
maximumFractionDigits
number
Maximum digits after the decimal point.
minimumSignificantDigits
number
Minimum significant digits. Mutually exclusive with fraction digit props.
maximumSignificantDigits
number
Maximum significant digits. Mutually exclusive with fraction digit props.
useGrouping
TNumberFormatUseGrouping
true
Thousands-separator behaviour. true/'auto' = locale default, false = none, 'always' forces separators, 'min2' only when ≥2 groups.
signDisplay
TNumberFormatSignDisplay
'auto'
Sign display strategy. 'auto' = only negatives get the sign.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'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

vue

Locale & grouping

vue

Custom slot

vue