Theme
FormatNumber
Formats numbers with Intl.NumberFormat
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
svelte
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { FormatNumber } from '@dryui/ui';
</script>
<FormatNumber>Content</FormatNumber>Import options
Root package
ts
import { FormatNumber } from '@dryui/ui'Per-component subpath
ts
import { FormatNumber } from '@dryui/ui/format-number'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Default
1,234.56
svelte
<FormatNumber value={1234.56} />Currency
$1,234.56 €1,234.56 £1,234.56
svelte
<FormatNumber value={1234.56} type="currency" currency="USD" />
<FormatNumber value={1234.56} type="currency" currency="EUR" />
<FormatNumber value={1234.56} type="currency" currency="GBP" />Percent
85%
svelte
<FormatNumber value={0.85} type="percent" />Notation
1M 1E6 1E6
svelte
<FormatNumber value={1000000} notation="compact" />
<FormatNumber value={1000000} notation="scientific" />
<FormatNumber value={1000000} notation="engineering" />Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
value | number | — | ✓ | — |
locale | string | — | — | — |
type | decimalcurrencypercentunit | — | — | — |
currency | string | — | — | — |
unit | string | — | — | — |
notation | standardscientificengineeringcompact | — | — | — |
minimumFractionDigits | number | — | — | — |
maximumFractionDigits | number | — | — | — |
minimumIntegerDigits | number | — | — | — |
minimumSignificantDigits | number | — | — | — |
maximumSignificantDigits | number | — | — | — |
Forwards <span> attributes via rest props. Common examples: id, style, aria-label.