macOS
JS behaviour
Sheet & alert
The Mac’s two modals: the sheet sliding from under the toolbar and dimming its parent, and the centred alert with a filled default button — Enter and Escape do the right thing.
Real scenarios
The component as it is used in a product — not a specimen grid.
Sheet & alert
«New scene» slides the form down from under the toolbar while the list dims behind it; «Close project» raises the alert — Enter answers the filled default, Escape cancels.
Save changes before quitting?
Your scene «Studio» has unsaved lighting changes.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| sheet | position | 'under toolbar' | The sheet emerges from the body’s top edge, not screen centre. |
| alert | buttons | 'default + cancel' | The default button is filled; Cancel beside it is plain. |
| keys | behaviour | 'Enter · Esc' | Enter accepts, Escape cancels; focus is trapped. |
Snippet
<div class="mcsheet">…form…</div>
<dialog class="mcalert">
<p>خروج ذخیره شود؟</p>
<footer><button>لغو</button><button data-default>ذخیره</button></footer>
</dialog>
<style>
.mcsheet { position: absolute; inset-inline: 0; inset-block-start: 52px; padding: 20px;
border-end-end-radius: 10px; border-end-start-radius: 10px;
background: #ececec; box-shadow: 0 12px 40px #00000038;
animation: mcsheet-in .3s cubic-bezier(.2,.9,.3,1); }
.mcalert { inline-size: 260px; border-radius: 12px; padding: 16px 20px;
background: #e8e8e8f2; backdrop-filter: blur(30px); }
[data-default] { background: #007AFF; color: #fff; }
</style>