Sweetalert2 does not show up in Laravel 12 - Livewire
03:58 09 Oct 2025

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

  1. install sweetalert2 : npm install sweetalert2
  2. in resources\js\app.js : import Swal from "sweetalert2"; window.Swal = Swal;
  3. in blade file : `@script window.addEventListener('swal-alert',function(e){ Swal.fire(e.detail); }); @endscript`
  4. 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 : this button-info is show up, but sweetalert2 does not show up, is this conflict ?

Please help.. Thank you...

laravel dispatch sweetalert2