Skip to content

Lazy loading

Modal components can be lazy loaded by using dynamic imports

import { modals } from 'svelte-modals'
modals.open(() => import('./AlertModal.svelte'), {
title: 'Lazy Modal',
message: 'This modal was loaded lazily'
})

While the component is being imported, the <Modals /> component will render backdrop and loading snippets. See <Modals /> API