On this page

Typography

Numeral

Locale-aware number formatting powered by Intl.NumberFormat.

Numeral formats a number with Intl.NumberFormat. It reads the active locale from React Aria's I18nProvider and accepts the relevant typography props from Text.

Numeral: Basic
Loading Numeral: Basic example

Format

Numeral uses decimal formatting by default. It infers currency or unit formatting when currency or unit is present. Set format to 'percent' or 'decimal' for those formats. Set it to 'currency' or 'unit' when you want that formatting explicit in the component call.

Numeral: Format
Loading Numeral: Format example

Compact notation

Set abbreviate for compact notation such as 12K. Pass "long" for a long display such as 12 thousand.

Numeral: Compact notation
Loading Numeral: Compact notation example

Precision

Pass a number for fixed fraction digits or a [min, max] tuple for a range. Use formatOptions for other Intl.NumberFormat options.

Numeral: Precision
Loading Numeral: Precision example

Formatting rules

Numeral throws when:

  • you provide both currency and unit.
  • you use format="currency" without a currency code.
  • you use format="unit" without a unit value.
  • precision is not a non-negative integer or a valid [min, max] tuple.

Typography and alignment

Numerals use tabular figures and end alignment by default, so values remain readable in a column. Set fontVariantNumeric, textAlign, or inherited Text typography props when the context needs a different treatment.

API

NumeralProps also accepts compatible DOM and ARIA attributes and event handlers for its rendered element.

NameTypeDefault
abbreviate
—

Enables compact notation (1.2K, 1.2 thousand).

color
"accent" |⁠ "danger" |⁠ "info" |⁠ "neutral" |⁠ "primary" |⁠ "secondary" |⁠ "success" |⁠ "warning" |⁠ undefined—

Sets text colour from the nearest Luke UI background. On a solid background, every semantic role reads as that background's primary colour. Omit it to inherit the surrounding colour.

currency
string—

Currency code such as USD.

fontStyle
"default" |⁠ "inherit" |⁠ "italic" |⁠ "normal" |⁠ undefined'default'

Sets font style.

fontVariantNumeric
"default" |⁠ "diagonal-fractions" |⁠ "normal" |⁠ "ordinal" |⁠ "slashed-zero" |⁠ "tabular-nums" |⁠ undefined'tabular-nums'

Numeric glyph rendering mode.

fontWeight
"body" |⁠ "emphasis" |⁠ "heading" |⁠ "label" |⁠ undefined—

Sets the semantic font-weight role. When omitted, the selected typography style supplies its weight.

format
—

Number format style. Inferred from currency/unit when omitted.

formatOptions
Intl.NumberFormatOptions—

Extra options passed to Intl.NumberFormat.

isVisuallyHidden
booleanfalse

Hides text visually while keeping it accessible.

lineClamp
1 |⁠ 2 |⁠ 3 |⁠ 4 |⁠ 5 |⁠ boolean |⁠ undefined—

Clamps text lines. true clamps to 1 line; numeric values clamp to 1–5.

locale
Intl.LocalesArgument—

Locale used for formatting. Defaults to locale context.

precision
—

Precision as fixed digits or [min, max] digits.

shouldDisableTrim
boolean |⁠ undefined—

Turns cap-height trim on or off. When omitted, trimming is disabled for inline or unknown element types. Line clamp always disables trim.

shouldInheritFont
boolean |⁠ undefinedfalse

Makes text inherit its surrounding font styles. Colour always inherits unless color is set.

textAlign
"center" |⁠ "end" |⁠ "start" |⁠ undefined'end'

Text alignment. Right-aligned by default for numeric columns.

textDecoration
"inherit" |⁠ "line-through" |⁠ "none" |⁠ "underline" |⁠ undefined'none'

Sets text decoration.

textTransform
"capitalize" |⁠ "default" |⁠ "inherit" |⁠ "lowercase" |⁠ "none" |⁠ "uppercase" |⁠ undefined'none'

Sets text transform.

textWrap
"balance" |⁠ "default" |⁠ "pretty" |⁠ undefined'default'

Sets text wrapping behavior.

typography
"body" |⁠ "caption" |⁠ "display" |⁠ "heading1" |⁠ "heading2" |⁠ "heading3" |⁠ "heading4" |⁠ "label" |⁠ "lead" |⁠ undefined'body'

Applies a complete typography style: family, size, weight, line height, letter spacing, and trim.

unit
NonNullable<Intl.NumberFormatOptions['unit']>—

Unit name when format is unit, e.g. kilometer.