Elements

Components

Format

Format, dressed in the paper-and-ink system: Intl formatting for numbers, currency, bytes and relative time. The parts — Number, Byte, Time, RelativeTime.

#Basic usage

format/basic Vue React
12,345.671.54 MB09:308 months ago

#Props

#Byte

PropTypeDefaultDescription
unit'bit' | 'byte'The unit granularity to display
unitDisplay'long' | 'short' | 'narrow'The unit display
unitSystem'decimal' | 'binary'The unit system to use for formatting
valuenumberThe byte size to format

#Number

PropTypeDefaultDescription
compactDisplay'short' | 'long' | undefined—
currencyDisplaystring | undefined—
currencySignstring | undefined—
notation'standard' | 'scientific' | 'engineering' | 'compact' | undefined—
signDisplay'auto' | 'never' | 'always' | 'exceptZero' | undefined—
unitstring | undefined—
unitDisplay'short' | 'long' | 'narrow' | undefined—
valuenumberThe byte size to format

#RelativeTime

PropTypeDefaultDescription
localeMatcherIntl.RelativeTimeFormatLocaleMatcherThe locale matching algorithm to use. For information about this option, see Intl page.
numericIntl.RelativeTimeFormatNumericThe format of output message.
styleIntl.RelativeTimeFormatStyleThe length of the internationalized message.
valueDateThe date to format

#Time

PropTypeDefaultDescription
valuestring | DateThe time to format