Gathering detailed insights and metrics for svelte-modals
Gathering detailed insights and metrics for svelte-modals
Gathering detailed insights and metrics for svelte-modals
Gathering detailed insights and metrics for svelte-modals
@nelhoa/svelte-modals
A flexible modal library with TailwindCSS.
svelte-promise-modals
The better way to handle modals in your Svelte apps. Promised! 🤞
viancorp-modals
Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
yasp-modals
Yet Another Svelte Package: Modals
A simple, flexible, zero-dependency modal stack manager for Svelte.
npm install svelte-modals
Typescript
Module System
Node Version
NPM Version
81.9
Supply Chain
98.5
Quality
80.3
Maintenance
100
Vulnerability
100
License
TypeScript (71.64%)
Svelte (17.7%)
JavaScript (10.67%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
164 Stars
115 Commits
11 Forks
3 Watchers
6 Branches
2 Contributors
Updated on Jul 16, 2025
Latest Version
2.0.1
Package Id
svelte-modals@2.0.1
Unpacked Size
19.88 kB
Size
5.81 kB
File Count
17
NPM Version
11.0.0
Node Version
22.11.0
Published on
Mar 09, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A simple, flexible, zero-dependency modal manager for Svelte.
1npm install svelte-modals
All opened modals will be rendered inside <Modals />
. If you're using SvelteKit, +layout.svelte
would be appropriate
place to put it. Otherwise, wherever you want the modals to be rendered.
1<script> 2 import { Modals } from 'svelte-modals' 3</script> 4 5<Modals> 6 <!-- shown when any modal is opened --> 7 {#snippet backdrop({ close })} 8 <div class="backdrop" onclick={() => close()} /> 9 {/snippet} 10</Modals> 11 12<style> 13 .backdrop { 14 position: fixed; 15 top: 0; 16 bottom: 0; 17 right: 0; 18 left: 0; 19 background: rgba(0, 0, 0, 0.5); 20 } 21</style>
Let's create a basic modal component:
1<script> 2 const { 3 // provided by <Modals /> 4 isOpen, 5 close, 6 7 // your props 8 title, 9 message 10 } = $props() 11</script> 12 13{#if isOpen} 14 <div role="dialog" class="modal"> 15 <div class="contents"> 16 <h2>{title}</h2> 17 <p>{message}</p> 18 <div class="actions"> 19 <button onclick={() => close()}>OK</button> 20 </div> 21 </div> 22 </div> 23{/if} 24 25<style> 26 .modal { 27 position: fixed; 28 top: 0; 29 bottom: 0; 30 right: 0; 31 left: 0; 32 display: flex; 33 justify-content: center; 34 align-items: center; 35 36 /* allow click-through to backdrop */ 37 pointer-events: none; 38 } 39 40 .contents { 41 min-width: 240px; 42 padding: 16px; 43 background: white; 44 display: flex; 45 flex-direction: column; 46 justify-content: space-between; 47 pointer-events: auto; 48 } 49 50 h2 { 51 text-align: center; 52 font-size: 24px; 53 } 54 55 p { 56 text-align: center; 57 margin-top: 16px; 58 border-radius: 6px; 59 } 60 61 .actions { 62 margin-top: 32px; 63 display: flex; 64 justify-content: flex-end; 65 } 66</style>
Import modals
anywhere in your app to open or close your modals
1<script> 2 import { modals } from 'svelte-modals' 3 import MyModal from '$lib/components/MyModal.svelte' 4 5 function handleClick() { 6 modals.open(MyModal, { title: 'Alert', message: 'This is an alert' }) 7 } 8</script> 9 10<button onclick={handleClick}>Open Modal</button>
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
Found 1/8 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More