ki-format-number
@kimen/elements/ki-format-number- Source
- Agent reference
Pass a finite raw number. The formatter reads the closest lang declaration
and shows tabular figures, which align neatly in columns.
<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
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
currency | currency | string | undefined | – | ISO 4217 currency code, such as EUR. Selects currency output when format-style is omitted. |
format-style | formatStyle | "decimal" | "percent" | "unit" | undefined | – | Decimal, percent or unit output. Without this option, currency selects currency output and other values use decimal. |
maximum-fraction-digits | maximumFractionDigits | number | undefined | – | Maximum number of fraction digits. |
minimum-fraction-digits | minimumFractionDigits | number | undefined | – | Minimum number of fraction digits. |
notation | notation | "compact" | undefined | – | Use compact notation for abbreviated large numbers. Omit for standard notation. |
unit | unit | string | undefined | – | Intl unit identifier, such as celsius or kilometer. Use with format-style="unit". |
value | value | number | 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.
| Token | Description |
|---|---|
--ki-format-number-font-family | Default body font family for ki-format-number on a bare page. |