Skip to content

Number Text

Free

Shows a formatted number inside a line of text: a short count, money, a percent, a unit, or bytes. When the text is short, the full value shows in a tooltip.

  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Pass the value and its kind. Put a NumberTextEmpty inside for a metric that has no data yet.

october-stats.tsx

NumberText

<data>
PropTypeDefaultDescription
currencystring—The ISO 4217 code of currency and compactCurrency. Default "USD".
unitstring—The Intl unit of the value for unit ("millisecond", "meter", "celsius"). Required for unit.
unitDisplay"long""narrow""short"—The unit text: "short" (default, 1.53 sec, 1.8 MB), "narrow" (1.53s), or "long" (1.53 seconds, 1.8 megabytes).
compactFromnumber—compact and compactCurrency write the full value below this size. Default 10,000.
signDisplay—The sign rule of Intl ("auto", "always", "exceptZero", "negative", "never"). Default "auto"; change defaults to "exceptZero", so 0 has no sign.
minorDigits"always""auto"—The minor digits (cents) of currency and of compactCurrency below compactFrom: "auto" (default) drops them from a whole value ($49, $49.50); "always" writes them on every value ($49.00), for a receipt, a price list, or a column of amounts that must line up. The currency sets the count (2 for USD, 0 for JPY: ¥12,000 in both modes).
valueRequirednumber | null—The number, or the start of a range. null, undefined, and NaN show the empty text.
endnumber | null—The end of a range: "$10–20K", "1st–3rd", "1.2–4.8 GB" (formatRange, so the locale picks the dash and writes the shared parts once). A range never rolls.
kind"bytes""change""compact""compactCurrency""currency""number""ordinal""percent""unit""number"The kind of text, the names of createNumberFormat: number (default), compact (184K), currency, compactCurrency ($48.2K), percent (a ratio: 0.024 is 2.4%), change (a signed ratio: +12.4%), unit (with unit; it climbs a ladder: 1532 ms is 1.53 sec), bytes (720 GB), ordinal (1st, 22nd in English).
formatNumberFormatOptions—Raw Intl.NumberFormat options in place of kind, for a value that a page already formats with Intl ({ style: "unit", unit: "fahrenheit" }). Nothing is cut, so there is no Tooltip.
tooltipbooleantrueWhen the text is shorter than the value (184K, 1.53 sec): a dotted underline, a Tooltip with the full value on hover, focus, and press. Default true. false shows the short text only.
animatedbooleanfalseRolls the digits on a change (the Rolling Number). Default false: the text swaps.
localestring—The BCP 47 locale. Default: the DisplayLocaleProvider locale, else "en-US".
childrenReactNode—A NumberTextEmpty part: the words of no value. With a value, they are not drawn.
...props<data> attributes—Every other attribute goes to the <data>, with a ref.

NumberTextEmpty

<div>
PropTypeDefaultDescription
data-slotstring—The data-slot of the root: the item's own slot ("time-ago"). Default "empty-value".
From Base UIUseRenderBase UI docs
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use kind for the format: compact, currency, percent, bytes, and others.
  • Pass end for a range.
  • Use NumberTextEmpty for a cell with no number.
  • For a price with its period, use a Price.
TabMoves to a shortened value and shows the full value in a Tooltip.

It renders a data element, and its value attribute keeps the raw number.

A range keeps both ends as start/end.

Value
none · with `animated`, the digits roll on a change

Built with

Installs with Number Text

  1. AddedNumber Text, with Full Value, Rolling Number.
Open the release