Skip to content

v2 Migration

v2 introduces Svelte 5 support and an API overhaul to better solve the community requests during v1. To make the migration easier, you can change all of your svelte-modals imports to svelte-modals/legacy which is a v1 wrapper around the new APIs. This should hopefully have no breaking changes, but please report any issues you find.

<script>
import { openModal, closeModal } from 'svelte-modals/legacy'
import MyModal from '../components/MyModal.svelte'
function handleClick() {
openModal(MyModal, { title: "Alert", message: "This is an alert" })
}
</script>
<button onclick={handleClick}>Open Modal</button>

What’s new?