Svuick

Packages Guides

@svuick/modal

npm (scoped)

Installation

npm i @svuick/modal

What is this?

This package provides a Modal component.

Example

Modal is currently closed

Usage

<script>
	import Modal from '@svuick/modal';

	let show = false;
</script>

<span>Modal is currently {show ? 'open' : 'closed'}</span>

<Modal let:open let:close bind:show>
	<div slot="modal">
		<h1>Svuick modal</h1>
		<button on:click={close}>Close</button>
	</div>
	<button on:click={open}>Open</button>
</Modal>

component options

  • show

    the component state

  • let:open (exported const)

    a callback to open the modal

  • let:close (exported const)

    a callback to close the modal

  • noCloseOnOuter

    dont close the model when clicked on background

  • enablePageScroll

    dont disable page scrolling when a modal is open

Released under the MIT License.
Copyright © 2022-present David Plugge