Skip to content

wire:confirm

Laravel Livewire Documentation Reference

Since Magewire is heavily inspired by Laravel Livewire, many concepts are either identical or very similar. To avoid duplicating documentation, this page only covers Magewire-specific and platform-specific details. For all general concepts and in-depth explanations, you can refer to the corresponding Laravel Livewire documentation.

Livewire Reference

Add wire:confirm to an action element when the browser should ask for confirmation before Magewire sends the call:

<button type="button"
        wire:click="deleteAddress"
        wire:confirm="<?= $escaper->escapeHtmlAttr(__('Delete this address?')) ?>">
    <?= $escaper->escapeHtml(__('Delete')) ?>
</button>

The .prompt modifier can require an exact phrase for especially deliberate actions; its expression contains the question and expected response separated by |. See the Livewire 3 reference for that syntax.

Confirmation runs entirely in the browser and can be bypassed. The component action must still authorize the current customer or admin user, validate the target, and handle repeated calls safely.