Install sweetalert2 package
yarn add sweetalert2
OR if you use importmap
./bin/importmap pin sweetalert2
Edit app/javascript/application.js
// app/javascript/application.js
import Swal from 'sweetalert2'
Turbo.setConfirmMethod((message, element) => {
return new Promise((resolve, reject) => {
Swal.fire({
title: "Notice!",
text: message || "Are you sure?",
icon: 'warning',
showCancelButton: true
}).then((result) => {
resolve(result.isConfirmed)
}).catch(error => { reject(error) })
})
})