You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Material Design 3 Dialog web component — framework-agnostic, built with Lit.
An accessible M3 Dialog web component following the Material Design 3 dialog specifications. Features expressive open/close animations, headline, content, and action slots. Works in Angular, React, Vue, Svelte, or plain HTML — no build step required.
Features
Basic and full-screen dialog variants
Expressive open/close animations
Headline, content, and actions slots
Focus trap and scroll lock when open
Keyboard accessible (Escape to close)
Accessible with ARIA dialog role
Framework-agnostic custom element
Installation
npm install @banegasn/m3-dialog
# or
pnpm add @banegasn/m3-dialog
# or
yarn add @banegasn/m3-dialog
CDN Usage (no build step)
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8" /><title>M3 Dialog Demo</title><scripttype="module" src="https://cdn.jsdelivr.net/npm/@banegasn/m3-dialog/+esm"></script><scripttype="module" src="https://cdn.jsdelivr.net/npm/@banegasn/m3-button/+esm"></script><style>body { font-family: Roboto, sans-serif; padding:32px; background:#fef7ff; }
</style></head><body><m3-buttonid="open-btn" variant="filled">Open Dialog</m3-button><m3-dialogid="my-dialog" headline="Confirm action"><p>Are you sure you want to delete this item? This action cannot be undone.</p><m3-buttonslot="actions" variant="text" id="cancel-btn">Cancel</m3-button><m3-buttonslot="actions" variant="filled" id="confirm-btn">Delete</m3-button></m3-dialog><script>constdialog=document.getElementById('my-dialog');document.getElementById('open-btn').addEventListener('button-click',()=>dialog.open=true);document.getElementById('cancel-btn').addEventListener('button-click',()=>dialog.open=false);document.getElementById('confirm-btn').addEventListener('button-click',()=>{console.log('Confirmed!');dialog.open=false;});</script></body></html>