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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-modaly

v2.1.2

Published

Easy to use modal window for React application

Readme

  • Trusted by best UI frameworks
  • Matching all your cases
  • Developer friendly API

NPM JavaScript Style Guide Build Status bundle size downloads Licence

Component to render your modal into Portals.

Features

  • Works through Portals.
  • No UI. You can use any UI or create your own.
  • Written on typescript.
  • React hooks support.
  • Very simple API.
  • Dependecies free.
  • 1kb size!!!

Install

npm install --save react-modaly

Usage

Step 1 - add modal Provider in project

Provider create modal context.

import { Provider as ModalProvider } from 'react-modaly';
import { config } from './modalConfig';
import Layout from './Layout';

const MODAL_NODE = document.getElementById('modal');

const App = () => (
  <ModalProvider node={MODAL_NODE}>
    <div>
      <h1>Example app</h1>
      <Form />
    </div>
  </ModalProvider>
);

Step 2 - create modal component

Example modal window

// ./Example.js
import React from 'react';
import { Button, Classes, Dialog } from '@blueprintjs/core';

export default ({ success, cancel, close }) => {
  const fill = () => success({ framework: 'react' });

  return (
    <Dialog icon="info-sign" onClose={close} title="" isOpen>
      <div className={Classes.DIALOG_BODY}>
        <p>Fill form with predefined data?</p>
      </div>
      <div className={Classes.DIALOG_FOOTER}>
        <div className={Classes.DIALOG_FOOTER_ACTIONS}>
          <Button intent="danger" onClick={cancel}>
            Clear field
          </Button>
          <Button intent="primary" onClick={fill}>
            Fill form
          </Button>
        </div>
      </div>
    </Dialog>
  );
};

Step 3 - Now you can use modal

import React, { useState, useCallback } from 'react';
import { useDialog, Modal } from 'react-modaly';
import { Button, InputGroup } from '@blueprintjs/core';

import ExampleModal from './ExampleModal';

const Form = () => {
  const [framework, setFramework] = useState('');
  const { isOpen, open, close } = useDialog();

  const handleClose = useCallback(() => {
    setFramework('');
    close();
  }, []);

  const handleSuccess = useCallback(({ framework }) => {
    setFramework(framework);
    close();
  }, []);

  return (
    <>
      <InputGroup
        placeholder="what the best framework"
        value={framework}
        onChange={e => setFramework(e.target.value)}
      />
      <Button text="Open example modal" onClick={open} />
      <Modal isOpen={isOpen} as="section">
        <ExampleModal close={close} cancel={handleClose} success={handleSuccess} />
      </Modal>
    </>
  );
};

export default Form;

Custom DOM element

You can pass prop as in Modal component if you need to change internal div element to any other.

  <Modal isOpen={isOpen} as="section">

Multiply modals

You can render modal into another modal because, Modal component create wrapper into portal.

Use typescript

The react-modaly source code is written in TypeScript, so you can rest easy that react-modaly's types will always be up-to-date.

Tips

Example app

Example app and code of example app

License

MIT © MerrickGit