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.

value
required
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

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

vue

Locale & grouping

vue

Custom slot

vue