Transaction button
The whole payment flow in one button: Pay → Processing (pixels ripple, the width springs to fit the words) → Paid; an error breaks the lock into a cross.
Real scenarios
The component as it is used in a product — not a specimen grid.
A checkout card
The wire:click one runs the real request: the label becomes "Processing", the pixels ripple and the width springs to fit the words — then the toast lands. The one beside it plays the whole machine locally and declines every other press.
Left: the server round-trip. Right: the local machine.
Driven by a real gateway
When your gateway answers asynchronously, set the status from the server and the same animation plays.
Right to left
The lock, the ripple and the rolling label all behave the same in RTL — the label direction follows the text.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| labels | array | [] | A map of idle · loading · success · error; missing keys fall back to the package’s built-in words. |
| status | string | null | Manual state for server-driven flows; with wire:click it also stays in sync with wire:loading. |
| size | string | 'md' | Sizes: sm · md · lg. |
| target | string | null | A manual wire:target when there is no wire:click. |
Snippet
<x-nx::transaction-button wire:click="save"
:labels="['idle' => 'پرداخت ۴۹ دلار', 'loading' => 'در حال پردازش…', 'success' => 'پرداخت شد', 'error' => 'رد شد']" />