npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

simple-modal-js

v0.3.0

Published

Simple modal generator in pure javascript

Readme

Simple Modal JS

Simple Modal JS is a lightweight, dependency-free library for creating customizable modal windows using JavaScript configuration objects. Developers can easily adjust the design, behavior, and other aspects of the modal without the need to write any CSS.

Ideal for developers looking for a quick, flexible, and easily integrable solution to display modal content in the browser.

Installation

CDN

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/main.min.js"></script>

<script>
    const modal = new SimpleModalJS();
    modal.show();
</script>

NPM

npm install simple-modal-js

Use with local files


<script src="node_modules/simple-modal-js/dist/main.min.js"></script>
<script>
    const modal = new SimpleModalJS();
    modal.show();
</script>

OR

<link rel="stylesheet" href="./node_modules/simple-modal-js/dist/style.css">
<script src="node_modules/simple-modal-js/dist/main.ems.js" type="module"></script>
<script>
    import SimpleModalJS from './node_modules/simple-modal-js/dist/main.ems.js';
    const modal = new SimpleModalJS();
    modal.show();
</script>

Use with bundlers


import SimpleModalJS from 'simple-modal-js';
import './dist/style.css'

const modal = new SimpleModalJS();
modal.show();

Features

| Method | Description | |:-------------------|:-----------------------------------------| | show() | Shows the modal window. | | hide() | Hides the modal window. | | removeFromDOM() | Removes the modal window from the dom. | | addToDOM() | Adds the modal window to the dom. |

| Property | Description | |:-----------------|:-------------------------------------------------------| | modalID | Contains the ID of the modal. | | $modalWrapper | Contains all the elements that are part of the modal. | | $modal_window | Saves the reference to the modal window. | | $modal_title | Saves the reference to the title. | | $modal_text | Saves the reference to the text of the modal window. | | $modal_close | Saves the reference to the close button. |

Configuration

You can customize the modal window by passing a configuration object when instantiating the class.

Overlay:

|Property |Type |Default value |Description | |:---------|:----------------------|:----------------:|---------------------------------| |show |boolean [true-false] |true | Defines visibility of overlay | |opacity |number [0-1] |0.8 | Sets opacity of overlay |

Modal: Title - Content

|Property |Type |Default value |Description | |:---------|:-----------------------------|:----------------:|----------------------------------------------| |text |string |"placeholder" | Defines the content of the element. | |textColor |string [valid color format] |"black" | Sets the text color. | |font |string |"san-serif" | Defines the font family. | |weight |string |"normal" | Sets the weight (or boldness) of the font. | |size |string [pixels] |"20px"/"18px" | Defines the text size. |


const modal = new SimpleModalJS({
    overlay: { 
        show: true, 
        opacity: 0.8 
    },
    modal: {
        title: {
            text: 'Window title',
            textColor: 'black',
            font: 'sans-serif',
            weight: 'bold',
            size: '20px',
        },
        content: {
            text: 'Enter the text that will appear in the modal window. The text size and color can be customized.',
            textColor: 'black',
            font: 'sans-serif',
            weight: 'normal',
            size: '18px',
        }
    }
});

License

MIT License. Copyright (c) 2025 Erik Medina