SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. It's even highly customizable, as you can see below!
The type of the modal. SweetAlert comes with 5 built-in types which will show a corresponding icon animation: "warning", "error", "success" "info" and "question". You can also set it as "input" to get a prompt modal. It can either be put in the object under the key "type" or passed as the third parameter of the function.
Custom Icon
imageUrl
is used to add a customized icon for the modal. Should contain a string with the path to the image.
Auto Close Timer
A message with auto close timer. timer
is default set to null
. You can set timer in ms (milliseconds).
Allow Outside Click
If allowOutsideClick
is set to true
, the user can dismiss the modal by clicking outside it.
Ajax Request
Set showLoaderOnConfirm
to true to disable the buttons and show that something is loading. AJAX request for example.
Button Options
Custom HTML description and buttons
Prompt Function
A replacement for the "prompt" function. You can set type
as "input" to get a prompt modal.
Confirm Button Action
A warning message, with a function attached to the "Confirm"-button.
Confirm & Cancel Button
Confirm and cancel button excecution options.
Chaining modals
Changing modal on next button.