SweetAlert2: Set dialog height

Issue

for sweetAlert2 I noticed there’s no “height” property but there is a “width” property, is there a way to set the height of the dialog to be 80%?

Thanks

https://limonte.github.io/sweetalert2/

Solution

You have to use a custom CSS class like in the snippet below:

const test = () => {
  swal({
     title: 'Test',
     customClass: 'swal-height'
  });

};
.swal-height {
  height: 80vh;
}
<script src="https://unpkg.com/[email protected]/dist/sweetalert2.all.js"></script>

<button onclick="test()">test</button>

Answered By – klugjo

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published