react-confirm-alert
react-confirm-alert copied to clipboard
How I can center in my display
hi, how I can apply style in my component. I try, style: "center"
closeModule() {
confirmAlert({
title: "Alerta",
message: "Desea salir sin aplicar los cambios ?",
style: "center",
buttons: [
{
label: "Si",
onClick: () => this._closeModule()
},
{
label: "No",
onClick: () => ""
}
],
closeOnEscape: false,
closeOnClickOutside: false
});
}
Hi! I was able to do it by this way (I use bootstrap and typescript):
confirmAlert({
(...)
})
setTimeout(() => {
const bodyElements: HTMLCollectionOf<Element> = document.getElementsByClassName('react-confirm-alert-body')
bodyElements[0]?.classList?.add('text-center')
bodyElements[0]?.firstElementChild?.classList?.add('h3')
bodyElements[0]?.firstElementChild?.classList?.add('mb-3')
const buttonGroupElements: HTMLCollectionOf<Element> =
document.getElementsByClassName('react-confirm-alert-button-group')
buttonGroupElements[0]?.classList?.add('d-block')
buttonGroupElements[0]?.classList?.add('m-auto')
buttonGroupElements[0]?.classList?.add('mt-4')
buttonGroupElements[0]?.firstElementChild?.classList?.add('bg-danger')
}, 200)