Method | Description
|
Swal.isVisible() |
Determine if modal is shown. |
Swal.mixin({ ...options }) |
Returns an extended version of `Swal` containing `params` as defaults. Useful for reusing Swal configuration. |
Swal.update({ ...options }) |
Updates popup options. |
Swal.close() |
Close the currently open SweetAlert2 modal programmatically, the Promise returned by Swal.fire() will be resolved with an empty object { } |
Swal.getContainer() |
Get the popup container which contains the backdrop. |
Swal.getHeader() |
Get the modal header. The header contains progress steps, the icon, the image, the title, and the close button. |
Swal.getTitle() |
Get the modal title. |
Swal.getCloseButton() |
Get the close button. |
Swal.getContent() |
Get the modal content. |
Swal.getImage() |
Get the image. |
Swal.getActions() |
Get the actions block (buttons container). |
Swal.getFooter() |
Get the modal footer. |
Swal.getFocusableElements() |
Get all focusable elements in the popup. |
Swal.getConfirmButton() |
Get the "Confirm" button. |
Swal.getCancelButton() |
Get the "Cancel" button. |
Swal.enableButtons() |
Enable "Confirm" and "Cancel" buttons. |
Swal.disableButtons() |
Disable "Confirm" and "Cancel" buttons. |
Swal.enableConfirmButton() |
Deprecated and will be removed in the next major release, use Swal.getConfirmButton()instead. Enable the "Confirm"-button only. |
Swal.disableConfirmButton() |
Deprecated and will be removed in the next major release, use Swal.getConfirmButton()instead. Disable the "Confirm"-button only. |
Swal.showLoading() or Swal.enableLoading() |
Disable buttons and show loader. This is useful with AJAX requests. |
Swal.hideLoading() or Swal.disableLoading() |
Enable buttons and hide loader. |
Swal.isLoading() |
Determine if modal is in the loading state. Related methods: Swal.showLoading() and Swal.hideLoading() |
Swal.getTimerLeft() |
Returns the time left in case when timerparameter is set. |
Swal.stopTimer() |
Stops the timer in case when timer parameter is set. Returns the time left |
Swal.resumeTimer() |
Resume the timer previously stopped. Returns the time left |
Swal.toggleTimer() |
Toggle state of the timer between stopped and running. Returns the time left |
Swal.isTimerRunning() |
Returns the status of a timer: true if is running, false if it's paused |
Swal.increaseTimer(n) |
Increase the timer by n milliseconds. Returns the time left |
Swal.clickConfirm() |
Click the "Confirm"-button programmatically. |
Swal.clickCancel() |
Click the "Cancel"-button programmatically. |
Swal.getInput() |
Get the input DOM node, this method works with the input parameter. |
Swal.disableInput() |
Disable input. A disabled input element is unusable and un-clickable. |
Swal.enableInput() |
Enable input. |
Swal.showValidationMessage(error) |
Show the validation message DOM node. |
Swal.resetValidationMessage() |
Hide the validation message DOM node. |
Swal.getValidationMessage() |
Get the validation message DOM node. |
Swal.queue([Array]) |
Provide an array of SweetAlert2 parameters to show multiple modals, one modal after another. |
Swal.getQueueStep() |
Get the index of current modal in the queue. When there's no active queue, null will be returned. |
Swal.insertQueueStep() |
Insert a modal to queue, you can specify modal positioning with the second parameter. By default, a modal will be added to the end of a queue. |
Swal.deleteQueueStep(index) |
Delete a modal at index from queue. |
Swal.getProgressSteps() |
Progress steps getter. |
Swal.setProgressSteps([]) |
Progress steps setter. |
Swal.showProgressSteps() |
Show progress steps. |
Swal.hideProgressSteps() |
Hide progress steps. |
Swal.isValidParameter(param) |
Determine if parameter name is valid. |
Swal.isUpdatableParameter(param) |
Determine if parameter name is valid for Swal.update() method. |