Data
FormatNumber <pm-format-number>
Formatted number: locale-aware decimal, currency, percent or compact ("1.2K") output, with an optional count-up when it scrolls into view (skipped when the user prefers reduced motion).
- Currency, counting up
- Compact
- Percent
Overview
Screen readers always get the final value.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
value | number | 0 | Current value. |
format | 'decimal' | 'currency' | 'percent' | 'compact' | — | decimal (default), currency, percent (0.42 → 42%) or compact (1200 → 1.2K). |
currency | string | — | ISO currency code for format="currency" (default USD). |
digits | number | — | Fixed number of fraction digits. |
locale | string | — | BCP 47 locale; defaults to the nearest lang attribute, then the browser's. |
count-upprop: countUp | boolean | — | Count up from zero when first visible, and between values afterwards. |
duration | number | — | Animation length in ms (default 900). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.