Actions JS behaviour

Border button

A button whose dashed frame marches; it spins under load, closes into a ring with a drawn check on success and shakes on error.

Real scenarios

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

A document editor’s footer

Save draft goes to the server (wire:loading spins the dashes, then a toast lands); Publish runs the full machine locally: loading → success or error → back, and every other press fails.

Driven from the server

The same button with :status from a Livewire property — sync endpoints that finish on their own schedule.

Reading the states

Nothing is motion-only: while it works the dashes spin, when it lands the ring closes into a check, and when it fails the frame shakes and reddens — with the label read out politely.

Important props

Important props
Prop Type Default What it does
status string null Manual loading · success · error; with wire:click it follows wire:loading automatically and the dashes spin.
successLabel / errorLabel string 'Done' / __('nabuxui::ui.failed') The label that replaces the default one in each state; it is also announced through the aria-live copy.
icon string null An icon beside the idle label.
size string 'md' Sizes: xs · sm · md · lg.
target string null When not using wire:click, give wire:target by hand so wire:loading picks the button up.

Snippet

<x-nx::border-button icon="file" wire:click="save" success-label="ذخیره شد">
    ذخیرهٔ پیش‌نویس
</x-nx::border-button>