Modal

A modal built on the native dialog element, so focus trapping, Escape and the top layer come for free. Closes on Escape, a backdrop click, or the close button.

Examples

Basic

Delete file

This action can't be undone.

Show code
<Modal bind:open title="Delete file">Are you sure?</Modal>

Props

PropTypeDefaultDescription
openbooleanfalseWhether the dialog is shown. Bind it with bind:open.
titlestring—Optional heading in the dialog header.

The dialog is always in the DOM and shown via showModal(); bind open to control it.