0.0.23 • Published 2 years ago
@svelte-parts/modal v0.0.23
@svelte-parts/modal
A simple modal for svelte
Try it out in the svelte REPL
Install
npm install @svelte-parts/modal
Usage
<script>
import Modal from '@svelte-parts/modal'
let open = false
</script>
<button on:click={() => open = true}>Demo</button>
<Modal open={open} onClose={() => open = false}>
<div class="modal">
<h1>Hello</h1>
<p>from a modal</p>
<p>Click outside of me to close</p>
</div>
</Modal>
<style>
.modal {
background-color: white;
padding: 2em;
border-radius: 0.5em;
min-width: 30vw;
}
</style>