Data JS behaviour

Currency converter

Currency conversion with rates that arrive through props — nothing is fetched; amounts are read in any numbering system (“12,500” and “۱۲٬۵۰۰” alike) and shown in your locale’s digits.

Real scenarios

The component as it is used in a product — not a specimen grid.

Paying the Berlin illustrator

The amount reads any numbering system — type «۱٬۲۵۰» and it lands as 1,250 — and every keystroke, currency swap and flip rides one Livewire property.

Convert

To €1,150.00

1 USD = 0.9200 EUR Mid-market · demo rates

On the server (wire:model.live): null

The Kyoto travel budget

A second, independent converter quoted against JPY — the block never fetches anything; the numbers are yours.

Daily budget

To $574.10

1 JPY = 0.0067 USD Cash & cards together

Important props

Important props
Prop Type Default What it does
rates array [] Rates quoted against any common base, supplied from outside.
amount / from / to number / string 1000 / null The starting amount and currency pair.
wire:model — null On the component itself: binds ['amount' => …, 'from' => …, 'to' => …] through x-modelable.
note / labels string / array null / [] The note under the result (the rate source, say) and custom words.

Snippet

<x-nx::currency-converter title="تبدیل" :rates="$rates" :amount="1250" from="USD" to="JPY"
    note="نرخ میانی · نرخ‌های نمایشی" wire:model.live="state.fx" />