Explore all the features and customization options
The standard styling for the popup
Green styling for success actions
Red styling for dangerous actions
Blue styling for informational popups
Dark mode styling for the popup
Material design inspired styling
Bootstrap inspired styling
Extra rounded corners styling
Popup appears above the button
Popup appears to the right
Popup appears below the button
Popup appears to the left
Customize the button labels
Fully customized popup with HTML
import { ConfirmPopup } from 'confirmly-popup';
const popup = new ConfirmPopup({
targetElement: document.querySelector('#myButton'),
onConfirm: () => {
console.log('Confirmed!');
},
onCancel: () => {
console.log('Cancelled!');
},
});
const popup = new ConfirmPopup({
targetElement: document.querySelector('#myButton'),
template: `
<div class="confirmly__popup confirmly__popup--custom">
<div class="confirmly__content">
<p class="confirmly__message">Are you really sure?</p>
<div class="confirmly__buttons">
<button data-button="confirm">Yes, proceed</button>
<button data-button="cancel">No, go back</button>
</div>
</div>
<div class="confirmly__arrow" data-popper-arrow></div>
</div>
`,
buttonClasses: {
confirm: 'btn btn-primary',
cancel: 'btn btn-secondary',
},
buttonContents: {
confirm: 'Yes, proceed',
cancel: 'No, go back',
},
defaultPlacement: 'top',
showError: true,
onConfirm: () => {
console.log('Action confirmed');
},
onCancel: () => {
console.log('Action cancelled');
},
});