HeroUI Pro

Number Value

A formatted number display with locale-aware rendering for currency, percentages, and compact notation.

Usage

Compact

Currency

Format Options

Percent

Sign Display

Tabular Nums

With Prefix Suffix

CSS Classes

Base Classes

  • .number-value - Base inline-flex wrapper

Element Classes

  • .number-value__prefix - Text before the formatted number
  • .number-value__value - The formatted number
  • .number-value__suffix - Text after the formatted number

API Reference

NumberValue

The root component. Formats and displays a number using locale-aware Intl.NumberFormat.

PropTypeDefaultDescription
valuenumber-Required. The numeric value to format
style'decimal' | 'currency' | 'percent' | 'unit''decimal'Formatting style
currencystring-Currency code (e.g. "USD"). Required when style is "currency"
unitstring-Unit type (e.g. "degree"). Required when style is "unit"
notation'standard' | 'compact' | 'scientific' | 'engineering''standard'Notation style
signDisplay'auto' | 'always' | 'exceptZero' | 'never'-Controls when the sign is displayed
minimumFractionDigitsnumber-Minimum number of fraction digits
maximumFractionDigitsnumber-Maximum number of fraction digits
localestring-Override the locale from the nearest I18nProvider
formatOptionsNumberFormatOptions-Format options passed directly to NumberFormatter. Overrides individual convenience props
childrenReactNode | ((formatted: string) => ReactNode)-Prefix/Suffix sub-components or a render function receiving the formatted string

Also supports all native span HTML attributes except children and style.

NumberValue.Prefix

Text displayed before the formatted number.

PropTypeDefaultDescription
childrenReactNode-Prefix text

Also supports all native span HTML attributes.

NumberValue.Suffix

Text displayed after the formatted number.

PropTypeDefaultDescription
childrenReactNode-Suffix text

Also supports all native span HTML attributes.

On this page