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

react-modal-dk2

v1.0.5

Published

React library for modals

Readme

React Modal Project

Welcome to the React Modal Project! This project provides a simple and customizable modal component for React applications.

Installation

You can install the React Modal Project via npm:

npm install react-modal-dk2

ou

yarn add react-modal-dk2

Usage

To use the project, follow these steps:

Import the module:

import Modal from 'react-modal-dk2;
import ModalTrigger from 'react-modal-dk2/dist/lib/ModalTrigger/ModalTrigger.js';
import { useModal } from 'react-modal-dk2/dist/lib/ModalContext/ModalContext.js';
import 'react-modal-dk2/dist/lib/ModalTrigger/ModalTrigger.css';

Props

The Modal component accepts the following props:

| Props | Description | | -----------------: | ------------------------------------------------------------------------------------------------------------- | | isOpen (boolean, required) | Controls whether the modal is open or closed. | | onClose (function, required) | Callback function to handle modal closing. | | title (string)| Title of the modal. | | closeText (string) | Text for the close button. | | closeClass (string) | Additional CSS class for the close button. | | closeExisting (boolean) | Option to close existing modals when opening a new one.| | escapeClose (boolean) | Option to close modal when pressing the escape key. | | clickClose (boolean) | Option to close modal when clicking outside. | | modalClass (string) | Additional CSS class for styling the modal. | | fadeDuration (number)| Duration of the fade animation.| | fadeDelay (number) | Delay for the modal fade-in animation. |

Examples

import React, { useEffect } from "react";
import ModalTrigger from 'react-modal-dk2/dist/lib/ModalTrigger/ModalTrigger.js';
import { useModal } from 'react-modal-dk2/dist/lib/ModalContext/ModalContext.js';
import 'react-modal-dk2/dist/lib/ModalTrigger/ModalTrigger.css';

function App() {
  const [modalOpen1, setModalOpen1] = useState(true);
  const [modalOpen2, setModalOpen2] = useState(true);

  return (
    <div className="App">
      <h1>React Modal Demo</h1>

      <Modal
        id="testModal1"
        open={modalOpen1}
        onClose={() => {
          setModalOpen1(false);
        }}
        content={<div>TEST1</div>}
        escapeClose={true}
      />

      <Modal
        id="testModal2"
        open={modalOpen2}
        onClose={() => {
          setModalOpen2(false);
        }}
        content={
          <div style={{ background: "red", width: 200 }}>
            <ModalTrigger
              id="textModal3"
              escapeClose={false}
              content={<h2>Modal Content 2</h2>}
              buttonText="Open"
            />
          </div>
        }
      />

      <ModalTrigger
        buttonText="Open"
        closeText="test close"
        closeClass="custom-close-class"
        closeExisting={true}
        escapeClose={true}
        clickClose={true}
        modalClass="custom-modal"
        fadeDuration={300}
        fadeDelay={0.5}
        content={
          <div>
            <h2>Modal Content 1</h2>
            <ModalTrigger
              id="textModal4"
              escapeClose={false}
              buttonText="Open"
              content={<h2>Modal Content 2</h2>}
            />
          </div>
        }
      />
    </div>
  );
}

export default App;

Customisation

You can customize the appearance and behavior of the modal by providing custom CSS classes or styles. Additionally, you can modify the Modal component to add more features or functionality as needed.

License

This project is licensed under the MIT License - see the [LICENSE] file for details.