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

modal-window-ap2a

v1.0.7

Published

This library provides a simple and reusable modal window component built with React and Vite. The modal window is designed to be used as a "success" modal, which can be displayed when a form is completed, a button is clicked, or any other event that requi

Readme

Modal Component

This library provides a simple and reusable modal window component built with React and Vite. The modal window is designed to be used as a "success" modal, which can be displayed when a form is completed, a button is clicked, or any other event that requires user feedback !

Context

It was made for a student project, where an old jQuery app was to be "converted into" a React one and its subsequent components were to be converted as well. Out of the 4 major components, the modal window was the one I chose to work on, to implement and to publish separately as well, the remaining ones being popular libraries that I imported.

Features

  • Easy to integrate into any React project
  • Customizable content through children props
  • Simple show/hide functionality
  • Styled with CSS for a clean and modern look : modal is encapsulated in an overlay that you can customize !

Installation

To install the modal component, you can use npm:

npm install modal-window-ap2a

It's already installed, but you need the last updated version ? Then just use :

npm update modal-window-ap2a

Usage

Here is an example of how to use the modal component in your React project, with a demo show button :

import { useState } from "react";
import Modal from "modal-window-ap2a";
import "modal-window-ap2a/modalwindow.css";

const App = () => {
  const [showModal, setShowModal] = useState(false);

  const handleClose = () => {
    setShowModal(false);
  };

  return (
    <div>
      <button onClick={() => setShowModal(true)}>Show Modal</button>
      <Modal
        show={showModal}
        onClose={handleClose}
        closeButtonX={true}
        closeButton={true}
      >
        <h1>Hello, Modal!</h1>
      </Modal>
    </div>
  );
};

export default App;

Props

The Modal component accepts the following props:

  • show (boolean): Determines whether the modal is visible or not.
  • onClose (function): Callback function to handle closing the modal.
  • children (node): The content to be displayed inside the modal.
  • closeButton (boolean): Determines whether the close button should be displayed. Default is true.

Customizing Styles

You can customize the appearance of the modal by overriding the default styles in your own CSS file. Here are the default class names you can target:

  • .modal__overlay: Styles the overlay background.
  • .modal__content: Styles the modal container.
  • .modal__close-btn: Styles the close button at the bottom (the cta).
  • .modal__close-btn-x: Styles the close button in the top right corner (the x).

Styling example

body .modal__overlay {
  background-color: rgba(0, 0, 0, 0.7);
}

body .modal__content {
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body .modal__close-btn {
  background-color: #5e6f21;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
}

body .modal__close-btn-x {
  background-color: #5e6f21;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
}