Click the preview button
See the overlay and dialog animate open with your chosen style.
Build a styled modal or dialog popup with your own content and animation, then copy the ready-to-use HTML, CSS and JavaScript.
See the overlay and dialog animate open with your chosen style.
Set the title, body text, button label and entrance animation.
Get a self-contained, accessible modal for your own project.
A trigger button adds an "open" class to the modal overlay, which CSS transitions handle for opacity and transform. Clicking the overlay or the close button removes the class.
Yes, clicking the dimmed overlay background closes the modal, while clicking inside the modal box itself does not, thanks to a simple event target check.
The generated markup uses role="dialog" and aria-modal="true" on the modal box, which helps assistive technology understand it as a dialog.