modal dialog alert warning session timeout modal dialog alert warning session timeout expiry alert dialog with warning icon session expiry notification modal
Modal Alert
Fetch pattern JSON:
curl https://webspire.de/patterns/modal/alert.json alert.html
<div class="flex min-h-64 items-center justify-center">
<button type="button" onclick="this.nextElementSibling.hidden=false" class="rounded-lg bg-amber-500 px-5 py-2.5 text-sm font-medium text-white shadow transition hover:bg-amber-600">Show Alert</button>
<div class="ws-modal fixed inset-0 z-50 flex items-center justify-center bg-[var(--ws-modal-overlay)] backdrop-blur-sm" hidden>
<div role="alertdialog" aria-modal="true" aria-labelledby="modal-alert-title" aria-describedby="modal-alert-desc" class="mx-4 w-full max-w-sm rounded-2xl bg-[var(--ws-modal-bg)] p-6 shadow-xl">
<div class="flex flex-col items-center text-center">
<div class="flex h-12 w-12 items-center justify-center rounded-full bg-amber-100">
<svg class="h-6 w-6 text-amber-600" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"/>
</svg>
</div>
<h2 id="modal-alert-title" class="mt-4 text-lg font-semibold text-[var(--ws-modal-text)]">Session Expiring</h2>
<p id="modal-alert-desc" class="mt-2 text-sm text-[var(--ws-modal-text-soft)]">Your session will expire in 5 minutes due to inactivity. Please save your work to avoid losing any unsaved changes.</p>
<button type="button" onclick="this.closest('.ws-modal').hidden=true" class="mt-6 w-full rounded-lg bg-amber-500 px-4 py-2.5 text-sm font-medium text-white transition hover:bg-amber-600">OK</button>
</div>
</div>
</div>
</div>
Details
Responsive Dark Mode Tailwind Only SSR Safe Copy & Paste Requires JS
Stable Published
modaldialogalertwarningsessiontimeout
Slots
| Name | Required | Description |
|---|---|---|
| icon | No | Warning icon indicator. |
| title | Yes | Alert heading text. |
| body | Yes | Alert message content. |
| action | Yes | Single OK dismiss button. |
Alert dialog with amber warning icon, centered layout, session expiry message, and single OK button. Uses role="alertdialog" for proper accessibility semantics. Simpler than the confirm variant with only one action.