Dialog
A native modal shell around <dialog>. It opens with showModal() (focus is trapped and the page behind is inert), closes on Escape or a click on the backdrop, and returns focus to what had it before. Layout and content stay the caller’s.
the event does not bubble past it.
| Type | Name | Description |
|---|---|---|
| boolean | open? |
Whether the dialog is open. Bindable. |
| string | label |
Accessible name of the dialog. |
| import(‘svelte’).Snippet | children? |
The content. |
| string | class? |
Extra classes on the dialog (it is already a card). |
| string | style? |
Extra inline style. |
| () => void | onclose? |
Called when the dialog closes. |
| (event: KeyboardEvent) => void | onkeydown? |
Keyboard handler for the dialog; |
<Dialog bind:open label="Rename file">
<header><h3>Rename</h3></header>
<div>…</div>
</Dialog>