modals
The main entry point for the modals API.
modals.open
Opens a modal. Returns a promise that resolves when the modal is closed. Value can be determined
by the modal using its close(value)
prop, otherwise it will resolve to undefined
.
Param | Type | Required | Description |
---|---|---|---|
component | SvelteComponent | Yes | Your Svelte modal component |
props | any | No | Props for the modal |
options | object | No | |
options.id | string | No | Gives the modal an id, which can be used for closeById(id) |
options.replace | boolean | No | This modal will replace the last modal in the stack |
modals.close
Closes the current modal or last amount
of modals in the stack. Returns true if
the modal was closed, false if the modal prevented the close.
Param | Type | Required | Description |
---|---|---|---|
amount | number | No | The number of modals to close. Defaults to 1 |
modals.closeById
Closes a modal by its id.
Param | Type | Required | Description |
---|---|---|---|
id | string | Yes | The id of the modal to close |
modals.closeAll
Closes all modals.
modals.stack
RuneAn array of the current stack of modals.
modals.action
RuneThe last action that was performed on the modals stack (push or pop). This can be useful for animations.