Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Format Number

Used to format numbers to a specific locale and options

StorybookArk

1,450.45

Usage

The number formatting logic is handled by the native Intl.NumberFormat API and smartly cached to avoid performance issues when using the same locale and options.

import { FormatNumber } from "@chakra-ui/react"
<FormatNumber value={1000} />

Examples

Percentage

Use the style=percentage prop to change the number format to percentage.

14.50%

Currency

Use the style=currency prop to change the number format to currency.

$1,234.45

Locale

Wrap the FormatNumber component within the LocaleProvider to change the locale.

de-DE

1.450,45

zh-CN

1,450.45

Unit

Use the style=unit prop to change the number format to unit.

384.4 km

Compact Notation

Use the notation=compact prop to change the number format to compact notation.

1.5M

Props

The FormatNumber component supports all Intl.NumberFormat options in addition to the following props:

PropDefaultType
value *
number

The number to format

Previous

For

Next

FormatByte