TallStackUI 4.0 is here! Seven new components and thousand of improvements. See what's new .

Powerful suite of Blade components for TALL Stack apps

Form Currency

Form currency component.

<x-currency />
Between 5,000 and 10,000 USD
<x-currency label="Salary Expectation" hint="Between 5,000 and 10,000 USD" />
<x-currency label="Readonly" value="500000" readonly />
<x-currency label="Disabled" value="500000" disabled />
<x-currency clearable />

The locale attribute follows Intl.NumberFormat rules and defaults to en-US. Set it to any supported locale to change the currency format.

$
USD
R$
BRL
Locale as pt-BR
EUR
Locale as es-ES
<!-- Default -->
<x-currency locale="en-US" />
 
<x-currency locale="pt-BR" />
 
<x-currency locale="es-ES" />

The component was built with two attributes that are intended to manipulate the JavaScript Intl.NumberFormat , called decimals and precision . You can use them to manipulate the JavaScript Intl.NumberFormat :

// <x-currency decimals="2" precision="4" />
 
new Intl.NumberFormat(this.locale, {
minimumFractionDigits: decimals,
maximumFractionDigits: precision,
}).format(number);
$
USD
$
USD
<x-currency label="Only symbol" symbol />
 
<x-currency label="Only currency code" currency />
 
<x-currency label="Both" symbol currency />

The symbols are not based on the locale attribute, but rather on your app's app.locale configuration. This is because you may want to display a currency for currencies other than your app's app.locale . If you want to replace the symbols at runtime, you can set a string value on it:

$$
$$
<x-currency symbol="$$" />
 
<x-currency currency="$$" />

With the mutate attribute, the component sends the formatted string exactly as it appears in the input , group separator and decimal separator included. Use it when you want to persist the user-facing representation verbatim (e.g., a free-text display label).

<x-currency mutate wire:model="price" />
Typed digits Display Sent to Livewire
1000 10.00 "10.00"
200000 2,000.00 "2,000.00"
150055 1,500.55 "1,500.55"

The decimal attribute strips the locale's group separator and normalizes the decimal separator to . , regardless of locale. The resulting string is directly castable via (float) / (int) or by Eloquent decimal:N / float casts.

<x-currency decimal wire:model="price" />
Typed digits Display Sent to Livewire
1000 10.00 "10.00"
200000 2,000.00 "2000.00"
150055 1,500.55 "1500.55"

A typical use case is binding to a column with an Eloquent decimal:2 cast:

// app/Models/Product.php
 
// ...
 
protected $casts = [
'price' => 'decimal:2',
];
<x-currency decimal wire:model="product.price" />

When bound to a Livewire property, the currency component offers three modes for sending the value to the server. Pick the one that matches how the value is persisted on the backend.

Mode Sent to Livewire When to use
Default (no prop) "200000" Stored as integer cents
mutate "2,000.00" / "2.000,00" Persisting the user-facing string verbatim
decimal "2000.00" Stored as decimal / float column

Mutually exclusive

mutate and decimal cannot be used together.

Code highlighting provided by Torchlight