sweetalert2 / sweetalert2-react-content

Official SweetAlert2 enhancer adding support for React elements as content
MIT License
706 stars 49 forks source link

Add `iconHtml` as a react element #146

Closed mihaerzen closed 3 years ago

mihaerzen commented 3 years ago

Hi!

It would be great if this library would also support iconHtml as a react element. We have a bunch of react element icons in our project and would be amazing if those can be re-used instead of rewriting them all into a css version.

I forked this project and tried adding this functionality but I'd appreciate some guidance. Here is the commit: https://github.com/mihaerzen/sweetalert2-react-content/commit/7bdd3efa28db6dd1ee1c02cc95f39c36225554c1

Specifically swal.getIcon() returns null and it could be the sweetalert library doesn't support this out of the box.

Any ideas? Thank you very much!

limonte commented 3 years ago

:tada: This issue has been resolved in version 3.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

zenflow commented 3 years ago

Specifically swal.getIcon() returns null and it could be the sweetalert library doesn't support this out of the box

@mihaerzen Don't forget to set the icon option alongside iconHtml! It took me a while to realize that this is required to use iconHtml in sweetalert2. It will determine the color of the circle and the inner content.

limonte commented 3 years ago

Don't forget to set the icon option alongside iconHtml! It took me a while to realize that this is required to use iconHtml in sweetalert2. It will determine the color of the circle and the inner content.

There should be a warning for that!