Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ciptaprogram's avatar

Sweetalert2 with Laravel 12 and Livewire

Hi all, I'm using Laravel 12 and Livewire 3, and now i'm trying to use sweetalert2 in may component file. These are what I already do :

  1. install sweetalert2 : npm install sweetalert2
  2. in resources\views\layouts\app.blade.php, after tag : @include('sweetalert::alert')
  3. in resources\js\app.js : import Swal from "sweetalert2"; window.Swal = Swal;
  4. in blade file : @script @endscript
  5. in component file when wire:click in the button executed : $this->dispatch('swal-alert', [ 'type' => 'success', 'title' => 'Success!', 'text' => 'Operation completed successfully.' ]);

But sweetalert2 does not show up. In the blade file, I also using : Loading... this button-info is show up, but sweetalert2 does not show up.

Please help.. Thank you...

0 likes
3 replies
ciptaprogram's avatar

In the blade file, I also using : tag button wire:loading class="btn btn-info" Loading... end tag button

Please or to participate in this conversation.