Android — Material 3 JS behaviour

Dialogs

Material’s basic dialog with icon, headline and trailing text buttons — plus the full-screen dialog for multi-step flows; their scrim is 32% black and they spring in from an 80% scale.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Two dialogs, one screen

The bin on each folder opens the basic dialog — icon, headline and end-aligned text buttons over the 32% scrim, springing from 80% scale. The + opens the full-screen flow with ✕, «Save» and a bottom bar. Escape closes both.

Files

۴ پوشه

No folders left — everything is safe in the trash.

Delete this folder?

The cancel button takes focus the moment the dialog opens, exactly as the a11y guidance asks; the destructive action wears the error colour.

Important props

Important props
Prop Type Default What it does
variant string 'basic' basic or full-screen; the full-screen one carries a bottom cancel/save bar.
radius length '28px' The official M3 dialog radius.
buttons layout 'text · end' Buttons are text-only and sit at the end of the row.

Snippet

<dialog class="m3dlg">
    <span class="m3dlg-icon">🗑</span>
    <h2>حذف پوشه؟</h2>
    <p>هر ۲۴ فایل داخلش هم حذف می‌شود.</p>
    <footer>
        <button>انصراف</button>
        <button data-destructive>حذف</button>
    </footer>
</dialog>

<style>
.m3dlg { border-radius: 28px; padding: 24px; inline-size: min(90vw, 360px);
         background: #ECE6F0; color: #1D1B20; }
.m3dlg footer { display: flex; justify-content: flex-end; gap: 8px; padding-block-start: 24px; }
.m3dlg[open] { animation: m3dlg-in .4s cubic-bezier(.05,.7,.1,1); }
</style>