Money
Formats an amount and currency with the provider's locale (tabular figures, sign before the symbol, no symbol when the currency is unknown).
Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. Pages vs components
Works with Dolfin’s SDK context, with appearance and behaviour you can customise. Requires DolfinProvider.
Installation
Needs the Dolfin registry token. The CLI copies the source into your app.
bunx --bun shadcn@4.23.0 add @dolfin/base-moneyAlso installs: ui-base-money.
Usage
import { Money } from "@/components/dolfin/base/money";
// Place it anywhere inside your <DolfinProvider>.
<Money amount={amount} currency={currency} />Renders inside DolfinProvider (set it up once). It renders the data you pass as props.
API reference
| Prop | Type | Description |
|---|---|---|
amount required | string | number | |
currency required | string | ISO 4217 code. Without one no symbol is shown, rather than a wrong one. |
locale | string | Overrides the provider's locale. |
muteZero | boolean | Mutes a zero amount, e.g. nothing outstanding. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.
useDolfinLocaleFiles
Written to your app by the install command:
components/dolfin/base/money.tsx32 lines