#027
Currency and locale
MoneyInput in three currencies and locales: USD en-US, JPY without decimals and EUR de-DE.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Currency and locale" pattern (@codeatlasdev/ui demo #027, inputs/money-input) in my app.
Call get_demo({ ids: ["#027"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Price fields in multi-currency products that must format and parse per locale.
Keep these library parts, with the props and tokens the demo uses:
- MoneyInput from "@codeatlasdev/ui/forms"
Behaviour to keep:
- `currency="USD" locale="en-US"` with `bind:value={usd}` starting at `$state(123456)`
- `currency="JPY" locale="en-US"` with `bind:value={jpy}` starting at `$state(1234)`
- `currency="EUR" locale="de-DE"` with `bind:value={eur}` starting at `$state(123456)`
- Labels: `Price (USD, en-US)`, `Price (JPY, no decimals)` and `Preis (EUR, de-DE)`
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- MoneyInput
@codeatlasdev/ui/forms
How it is built
- `currency="USD" locale="en-US"` with `bind:value={usd}` starting at `$state(123456)`
- `currency="JPY" locale="en-US"` with `bind:value={jpy}` starting at `$state(1234)`
- `currency="EUR" locale="de-DE"` with `bind:value={eur}` starting at `$state(123456)`
- Labels: `Price (USD, en-US)`, `Price (JPY, no decimals)` and `Preis (EUR, de-DE)`
Related
Loading source.