API Reference
<Modals />
Handles the rendering of your modals in the stack
Snippets
backdrop
Renders when any modals are open. The slot is empty by default.
loading
Rendered when the current modal is being lazy loaded (see Lazy Loading).
modals
Renders the current stack of modals. If you wish to modify the behaviour of how the stack is rendered, you can override this snippet.
openModal
Opens a new modal
Param | Type | Required | Description |
---|---|---|---|
component | Component | Yes | Your Svelte modal component |
props | any | No | Props for the modal |
options | object | No | |
options.replace | boolean | No | This modal will replace the last modal in the stack |
closeModal
Closes the last modal in the stack
closeModals
Closes the provided amount of modals
Param | Type | Required | Description |
---|---|---|---|
amount | number | Yes | The number of modals to close |
closeAllModals
Closes all modals in the stack
onBeforeClose
Allows a Modal to prevent itself from being closed
$modals
A Svelte store containing the current stack of modal components and their props
$action
A Svelte store describing how the current modal came to be active (“push” or “pop”). This can be useful for transitions if they should animate differently based on the action.