
This option is normally coupled with the position parameter and a timer. Whether or not an alert should be treated as a toast notification. Can be either a boolean or a string which will be assigned to the CSS background property. Whether or not SweetAlert2 should show a full screen click-to-dismiss backdrop. Use this to change the color of the icon.ĬSS classes for animations when showing a popup (fade in)ĬSS classes for animations when hiding a popup (fade out) It can either be put in the array under the key "icon" or passed as the third parameter of the function. SweetAlert2 comes with 5 built-in icon which will show a corresponding icon animation: warning, error, success, info, and question. It is the developer's responsibility to escape any user input when using the html option, so XSS attacks would be prevented. SweetAlert2 does NOT sanitize this parameter. If text and html parameters are provided in the same time, html will be used.


Here are the keys that you can use if you pass an object into sweetAlert2:
