Search code examples
sweetalert2tailwind-css

Sweetalert2: Remove inline style applied to elements


I use Tailwindcss alongside the sweetalert2. and use this config to generate an alert:

customClass: {
  ...
  image: 'hidden md:inline-block',
},

I use ImageUrl for Alert config. So my swal2-header contains:

<img class="swal2-image hidden md:flex" src="/path/to/image" alt="" style="display: flex;">

Due to the hidden and md:flex classes, I expect the image to be hidden in small resolution and become visible for md breakpoint, but the inline style="display: flex;" disables my hidden classes and actually is replaced with it. So how could I remove or disable the inline class?


Solution

  • Masih, the author of SweetAlert2 here.

    I just published the new version of SweetAlert2 (v9.13.1) which doesn't set style="display: flex;" on the image.

    Cheers!