Format

Format is used to format dates, numbers, and bytes according to a specific locale.

1.23 MB1,234,567.89

Usage

import { Format } from "@yamada-ui/react"
<Format.Byte />
<Format.Number />

Dates

Changing the Locale

To change the locale, set a value for locale.

en-US

10/18/2025

ja-JP

2025/10/18

de-DE

18.10.2025

fr-FR

18/10/2025

zh-CN

2025/10/18

Converting to Year

To convert to year, set a value for year.

2025

Converting to Month

To convert to month, set a value for month.

October

Converting to Day

To convert to day, set a value for day.

18

Converting to Weekday

To convert to weekday, set a value for weekday.

Saturday

Numbers

Changing the Locale

To change the locale, set a value for locale.

en-US

1,234,567.89

ja-JP

1,234,567.89

de-DE

1.234.567,89

fr-FR

1 234 567,89

zh-CN

1,234,567.89

Converting to Currency

To convert to currency, set "currency" for style.

USD

$1,234,567.89

EUR

1.234.567,89 €

JPY

¥1,234,568

Converting to Units

To convert to units, set "unit" for style.

100 kg100 degrees Celsius100km/h

Converting to Percent

To convert to percent, set "percent" for style.

45%45.00%

Converting Notation

To convert notation, set a value for notation.

1,234,567.891.235E61.235E61.2M

Controlling Decimal Places

To control the number of decimal places, use minimumFractionDigits and maximumFractionDigits.

1,234.501,234.5671,234.0000

Disabling Grouping

To disable grouping, set false for useGrouping.

1234567.89

Changing the Sign Display

To change the sign display, set a value for signDisplay.

+1,234.5-1,234.5

Bytes

Automatic Unit Selection

Format.Byte automatically selects the most appropriate unit (byte, kB, MB, GB, TB) based on the byte value size.

512 byte1.02 kB1.05 MB1.07 GB1.1 TB

Changing the Locale

To change the locale, set a value for locale.

en-US

1.02 kilobytes

ja-JP

1.02 キロバイト

de-DE

1,02 Kilobyte

fr-FR

1,02 kilooctet

zh-CN

1.02千字节

Unit Format

To convert units, set unit to either "byte" or "bit". The default is "byte".

Bytes

1.02 kB

Bits

1.02 kb

Changing the Unit Display

To change the unit display, set a value for unitDisplay.

Short

1.02 kB

Narrow

1.02kB

Long

1.02 kilobytes

Set the Locale for the Entire Application

If you want to set the locale for the entire application, set the locale for the UIProvider.

import { UIProvider } from "@yamada-ui/react"

const App = () => {
  return (
    <UIProvider locale="en-US">
      <Format.Byte value={1024} />
      <Format.Number value={1234567.89} />
    </UIProvider>
  )
}

Props