{% extends "base.html" %} {% block title %}Dialog Modals - Design System Wiki{% endblock %} {% block content %}
{% include "components/sidebar.html" %}
Overlays

Dialog Modals

Overlay window popups centering inside the viewport with scale animations, hardware blur filters, and document-level listeners for escape-key/backdrop dismissals.

Modal Showcase & Integration

How the Global Modal JS Works

The global script components.js runs automatically on page load and monitors specific attributes and classes. Here is what makes the modal operational:

Selector / Class Type Behavior & Purpose
[data-modal-target] Attribute Applied to buttons or triggers. The value must match the ID of the modal dialog (e.g., data-modal-target="my-modal"). Clicking it triggers openModal("my-modal").
.modal-dialog Class The outer wrapper container. Starts with the class hidden. The JS removes/adds hidden to show/hide the popup.
.modal-content Class The inner dialog panel card. The JS looks for this class to toggle transitions (adds scale-100 opacity-100 on show; resets to scale-95 opacity-0 on hide).
.modal-backdrop Class The dark blur overlay. The JS toggles its opacity and registers clicks on it to automatically close the modal.
.modal-close Class Applied to any close button (e.g., "Cancel", "Confirm", or an "X" icon). Clicking any element containing this class triggers modal closure.
💡 What is customizable?

You can customize the styling, colors, layout, and sizing of the .modal-content card freely. You must preserve the classes listed above so the Javascript code can target them and apply animations correctly.

{% endblock %}