Skip to content
Kimenpre-v1documentation home
Color scheme

ki-format-number

Pass a finite raw number. The formatter reads the closest lang declaration and shows tabular figures, which align neatly in columns.

Theme for this example
Color scheme for this example

<div lang="es-ES">
<p><ki-format-number value="1284.5"></ki-format-number></p>
<p><ki-format-number value="49" currency="EUR"></ki-format-number></p>
<p><ki-format-number value="0.496" format-style="percent" maximum-fraction-digits="1"></ki-format-number></p>
</div>

Set currency to an ISO currency code. Use format-style="percent" for ratios and format-style="unit" with an Intl unit identifier. Set notation="compact" to abbreviate large values, and fraction-digit bounds to control precision.

API reference

When to use: For numeric data, currency amounts, ratios and measurements in content.

When not to use: For numeric input or values that already include localized formatting.

Properties & attributes

AttributePropertyTypeDefaultDescription
currencycurrencystring | undefined–ISO 4217 currency code, such as EUR. Selects currency output when format-style is omitted.
format-styleformatStyle"decimal" | "percent" | "unit" | undefined–Decimal, percent or unit output. Without this option, currency selects currency output and other values use decimal.
maximum-fraction-digitsmaximumFractionDigitsnumber | undefined–Maximum number of fraction digits.
minimum-fraction-digitsminimumFractionDigitsnumber | undefined–Minimum number of fraction digits.
notationnotation"compact" | undefined–Use compact notation for abbreviated large numbers. Omit for standard notation.
unitunitstring | undefined–Intl unit identifier, such as celsius or kilometer. Use with format-style="unit".
valuevaluenumber | undefined–Raw finite number. A percent uses a ratio, so 0.49 displays as 49%.

CSS custom properties

The public styling contract of ki-format-number: reassign these tokens at :root or on a subtree — never override internals.

TokenDescription
--ki-format-number-font-familyDefault body font family for ki-format-number on a bare page.

Workshop

Open ki-format-number in Storybook