Skip to content
GitHub

Format

Format numbers, bytes, and time with Intl API.

File size120 kB

Installation

Usage

Examples

Format Byte

Format byte values as file sizes.

File size120 kB

Unit display

Use the unitDisplay prop to control how the unit is displayed.

Long: 1.5 megabytes
Short: 1.5 MB
Narrow: 1.5MB

Unit system

Use unitSystem to choose between decimal (1000 bytes) or binary (1024 bytes).

Decimal (1000): 1.02 kB
Binary (1024): 1 kB

Format Relative Time

Format dates as relative time.

Last updated11 months ago

Style

Use the style prop for long, short, or narrow format.

Long: 11 months ago
Short: 11 mo. ago
Narrow: 11mo ago

Format Number

Format numbers with locale-aware options.

Downloads1,234,567per month

Currency

Use style="currency" with the currency prop for currency formatting.

USD: $99.99
EUR: €99.99
BRL: R$99.99

Percentage

Use style="percent" to format numbers as percentages.

Default: 75%
With decimals: 75.67%

Compact notation

Use notation="compact" for compact display.

1.2M: 1.2M
120K: 120K
Downloads: 1.2M per month

API Reference

FormatByte

FormatRelativeTime

FormatNumber


For a complete list of props, see the Ark UI documentation.