.custom-confirm-button {
background-color: red !important;
color: white !important;
border: none !important;
}
.custom-title {
font-size: 15px !important;
}
.custom-icon {
font-size: 10px !important;
}
.custom-confirm-button .swal2-icon svg {
width: 12px !important;
height: 12px !important;
}
.swal2-actions .swal2-confirm {
background-color: #f1c40f !important;
color: white !important;
border: none !important;
box-shadow: none !important;
}
.swal2-actions .swal2-cancel {
border-color: #f1c40f !important;
box-shadow: none !important;
border: none !important;
}
.swal2-confirm:focus, .swal2-cancel:focus {
box-shadow: none !important;
border: none !important;
}
.swal2-actions button:hover {
border: none !important;
}
Here is a customized version of sweetalert2:
Swal.fire({
icon: 'warning',
title: 'Are you sure?',
text: 'This action cannot be undone.',
showCancelButton: true,
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, cancel!',
customClass: {
confirmButton: 'custom-confirm-button',
title: 'custom-title',
icon: 'custom-icon'
},
html: `
<div style="max-height: 300px; overflow-y: scroll;">
${allItems.map((item) => `
<div key="${item.asset_number}">
<div>
<p>Name: ${item.name}</p>
<p>Address: ${item.address}</p>
</div>
<hr style="border-color: gray; border-width: 1px; margin: 10px 0;" />
</div>
`).join('')}
</div>
`,
}).then((result) => {
if (result.isConfirmed) {
Swal.fire('Deleted!', 'Your item has been deleted.', 'success');
} else if (result.isDismissed) {
Swal.fire('Cancelled', 'Your item is safe :)', 'error');
}
});
I hope this version suits your needs.