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

modalwh-oc14

v1.1.0

Published

A simple and customizable modal component for react

Downloads

22

Readme

ModalWh for OC project 14, a simple and customizable modal component for react

Install

npm i modalwh-oc14

or

yarn add modalwh-oc14

NPM link

customizable react modal by michel brousse on NPM

Use

The component has 4 avaible props and the children special prop of react:

- modalState:
    - Modal state, true for show, false for hide.
    - Boolean
    - **Required**
- setModalState:
    - Modal state handler.
    - Function
    - **Required**
- modalStyle:
    - If you want to customize the modal style, pass an object with the shape describre bellow, the css rules for each part must be wrap in template literal string, more detail in example section.
    - Object
    - Optional
- customCloseButton:
    - If you want change the default one just put your's, dont forget to pass the modal state handler to close the modal on click.
    - React Element
    - Optional
- children:
    - Special property of React components which contains any child elements defined within the component, put all the content of the modal here.
    - Anything you want
    - Optional

Simple Example:

    // 1 - Import the Modal component into the file
    import { ModalWh } from modalwh-oc14

    const App = () => {
        // 2 - Setup state and handler for the modal
        const [modalState, setModalState] = useState(false)
        return (
            <>
                {/* In this example, a simple button are the trigger for open the modal  */}
                <button onClick={() => setModalState(true)}>Open Modal</button>

                {/* 3 - Pass the state and the handler to the modal, that's all, the modal works */}
                <ModalWh
                    modalState={modalState}
                    setModalState={setModalState}
                >
                    {/* This is where all the content you want in the modal goes (forms, images, text...), the children props */}
                    Content of the modal
                </ModalWh>
            </>
        )
    }

Result:

modal-demo.gif

Customize the modal style:

// Pass this object to modalStyle props, each property are optional
const modalStyle = {
  main: `background: red`,
  container: `
      border-radius: 0;
      height: 300px;
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: blue;`,
  content: `
      background: green;
      padding: 10px;`,
  closeButton: `
      opacity: 0.7;
      &:after, &:before {
        background-color: white;
      }`,
}

Result:

Capture-d-cran-de-2022-04-25-18-06-01.png

To see the code you overload for each property: https://github.com/mb47000/modalwh-oc14/blob/master/src/lib/modalWh/style.js