Marigold
Getting StartedFoundationsComponentsPatternsRecipesReleases
Discover new Tutorials!

Components

Overview

Application

MarigoldProvider
updated
RouterProvider
updated

Layout

Aside
Aspect
Breakout
Center
Columns
Container
Grid
Inline
Inset
Scrollable
Split
Stack
updated
Tiles

Form

Autocomplete
Button
updated
Calendar
Checkbox
ComboBox
DateField
DatePicker
Form
Multiselect
new
NumberField
Radio
SearchField
Select
Slider
Switch
TextArea
TextField
TimeField
new

Collection

SelectList
updated
Table
updated
Tag

Navigation

Accordion
Breadcrumbs
beta
Pagination
Tabs

Overlay

ContextualHelp
new
Dialog
Menu
Toast
beta
Tooltip
updated

Content

Badge
Body
Card
Divider
updated
Footer
Header
Headline
updated
Icon
updated
Image
Link
updated
List
updated
SectionMessage
SVG
updated
Text
updated
VisuallyHidden
updated
XLoader

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
useAsyncListData
useListData
useResponsiveValue
useTheme

NumericFormat

Helper component for formatting numeric based on the current language and locale-specific conventions.

With <NumericFormat> helper, you can easily ensure that numeric values are displayed consistently and accurately, taking into account factors such as decimal separators, currency symbols, and grouping separators specific to each language.

The <NumericFormat> component is built on top of the Intl.NumberFormat API, which provides comprehensive support for formatting numbers according to locale-specific conventions.

Usage

Use <NumericFormat> when you want to display numeric values like currencies, percentages, or large numbers in a way that automatically adapts to the user's locale and language preferences. It is particularly useful for presenting read-only values in UI components such as tables, cards, and labels.

There is no need to use <NumericFormat> with input components like NumberField, as they already include their own built-in number formatting and parsing behavior.

Customization options

You can customize how numbers are displayed by passing any Intl.NumberFormat options directly as props to <NumericFormat>. This includes settings like how many decimal places to show, whether to format values as currency or percentages, and how to abbreviate large numbers.

You can mix and match these options to match your needs. For a full list of available options, see the Intl.NumberFormat documentation.

Preview
Code
Locale
199,99 €25,7 %1,3 Mio.3,1416+42

Formatting ranges

The <NumericFormat> component can also format a pair of values as a localized range. By passing an array of two numbers to the value prop, you can automatically display them with the correct range separator, grouping, and digit formatting for the current locale.

Preview
Code
12–88%$29.99 – $59.9912–88%5–12km

For accessibility, screen readers will treat the formatted range as one continuous string (for example, “1,000 – 5,000”). This works well in most cases, but if your interface needs to convey the start and end values as distinct pieces of information, you can render them as two separate <NumericFormat> components and supply explicit ARIA labels. This ensures that assistive technologies announce each value in context.

<Stack role="group" aria-labelledby="price-range-label">
  <span id="price-range-label" className="visually-hidden">
    Price range
  </span>
  <NumericFormat value={1000} aria-label="Minimum price" />
  <span aria-hidden="true"> – </span>
  <NumericFormat value={5000} aria-label="Maximum price" />
</Stack>

Tabular display

Use the tabular prop to align numbers in columns or tables. When enabled (the default), each digit has the same width, keeping rows straight. This is ideal for data tables, financial reports, or any layout where vertical alignment helps. To disable it, set tabular={false}.

Preview
Code
ProductPriceQtyTotal
USB-C Cable$9.193$27.57
Wireless Charger$19.952$39.90
Bluetooth Speaker$4.515$22.55
External Hard Drive$129.991$129.99
LED Monitor$199.392$398.78
Gaming Mouse$49.873$149.61

Numbering system

Different locales use different numeral systems (for instance, Arabic or Devanagari digits). By specifying the numberingSystem prop, you can force the component to render numbers using any supported Unicode digit set, regardless of the current locale. This is useful when you want to match the visual style of a brand, support specific audience preferences, or demonstrate alternative numeral forms.

Preview
Code
𝟣𝟤𝟥,𝟦𝟧𝟨١٢٣٬٤٥٦১২৩,৪৫৬१२३,४५६.७८𝟣,𝟢𝟢𝟢% – 𝟧,𝟢𝟢𝟢%

Props

compactDisplay?
"short" | "long";
currency?
string;
currencyDisplay?
keyof NumberFormatOptionsCurrencyDisplayRegistry
currencySign?
"standard" | "accounting";
localeMatcher?
"lookup" | "best fit";
maximumFractionDigits?
number;
maximumSignificantDigits?
number;
minimumFractionDigits?
number;
minimumIntegerDigits?
number;
minimumSignificantDigits?
number;
notation?
"standard" | "scientific" | "engineering" | "compact";
numberingSystem?
string;
The numberingSystem accessor property of Intl.Locale instances returns the numeral system for this locale.
roundingIncrement?
1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000;
roundingMode?
"ceil" |
  "floor" |
  "expand" |
  "trunc" |
  "halfCeil" |
  "halfFloor" |
  "halfExpand" |
  "halfTrunc" |
  "halfEven";
roundingPriority?
"auto" | "morePrecision" | "lessPrecision";
signDisplay?
keyof NumberFormatOptionsSignDisplayRegistry
tabular?
boolean;
Specifies that the digits should take the full width.
Defaults to:
"true"
trailingZeroDisplay?
"auto" | "stripIfInteger";
unit?
string;
unitDisplay?
"short" | "long" | "narrow";
useGrouping?
boolean | keyof NumberFormatOptionsUseGroupingRegistry | "true" | "false"
value
number |
  bigint |
  StringNumericLiteral |
  [number, number] |
  [bigint, bigint] |
  [StringNumericLiteral, StringNumericLiteral];
Value to be formatted.
Last update: a month ago
Build with 🥵, 🧡 and
v14.1.1