Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
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).

Full screen
Currency, counting up
Compact
Percent

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/format-number'; </script> <dl class="pm-cluster" style="gap: var(--pm-space-8); margin: 0"> <div class="pm-stack" style="gap: 2px"> <dt class="pm-text-xs pm-muted">Currency, counting up</dt> <dd class="pm-text-2xl" style="margin: 0; font-weight: 600"> <pm-format-number value="48210" format="currency" currency="USD" count-up></pm-format-number> </dd> </div> <div class="pm-stack" style="gap: 2px"> <dt class="pm-text-xs pm-muted">Compact</dt> <dd class="pm-text-2xl" style="margin: 0; font-weight: 600"> <pm-format-number value="1284000" format="compact"></pm-format-number> </dd> </div> <div class="pm-stack" style="gap: 2px"> <dt class="pm-text-xs pm-muted">Percent</dt> <dd class="pm-text-2xl" style="margin: 0; font-weight: 600"> <pm-format-number value="0.427" format="percent" digits="1"></pm-format-number> </dd> </div> </dl>

Overview

Screen readers always get the final value.

Attributes

AttributeTypeDefaultDescription
valuenumber0Current value.
format'decimal' | 'currency' | 'percent' | 'compact'—decimal (default), currency, percent (0.42 → 42%) or compact (1200 → 1.2K).
currencystring—ISO currency code for format="currency" (default USD).
digitsnumber—Fixed number of fraction digits.
localestring—BCP 47 locale; defaults to the nearest lang attribute, then the browser's.
count-up
prop: countUp
boolean—Count up from zero when first visible, and between values afterwards.
durationnumber—Animation length in ms (default 900).

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Used in templates

Landing page