1Swal.fire({
2 title: 'Do you want to save the changes?',
3 showDenyButton: true,
4 showCancelButton: true,
5 confirmButtonText: `Save`,
6 denyButtonText: `Don't save`,
7}).then((result) => {
8 /* Read more about isConfirmed, isDenied below */
9 if (result.isConfirmed) {
10 Swal.fire('Saved!', '', 'success')
11 } else if (result.isDenied) {
12 Swal.fire('Changes are not saved', '', 'info')
13 }
14})
1swal({
2 title: 'Input something',
3 input: 'text',
4 showCancelButton: true,
5 inputValidator: function(value) {
6 return new Promise(function(resolve, reject) {
7 if (value) {
8 resolve();
9 } else {
10 reject('You need to write something!');
11 }
12 });
13 }
14}).then(function(result) {
15 swal({
16 type: 'success',
17 html: 'You entered: ' + result
18 });
19})
1Swal.fire(
2 'Data Add Successfully!',
3 'You clicked the button!',
4 'success'
5)
1const { value: email } = await Swal.fire({ title: 'Input email address', input: 'email', inputLabel: 'Your email address', inputPlaceholder: 'Enter your email address'})if (email) { Swal.fire(`Entered email: ${email}`)}