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-open-dialog

v1.2.1

Published

Open Dialog as function call or react component.

Readme

react-open-dialog

Open Dialog as function call or react component.

NPM JavaScript Style Guide

Features

  • Easy to use
  • Open Dialog as function call.
  • Open Dialog as react component.
  • Get nice and user friendly confirm dialog.
  • Create your own custom Dialog with jsx

Demo

Demo Page

Install

npm install --save react-open-dialog

Peer Dependency

This package has a peer dependency with @material-ui/core package so make sure to install this also.

npm install --save @material-ui/core

Usage

Open Confirm Dialog as function

As Function

import React from 'react'

import { DialogUtils } from 'react-open-dialog'

const App = () => {
  return (
    <div>
      <button
        onClick={() => {
          DialogUtils.openConfirmDialog({
            title: 'Dilog Title',
            message:
              'Elit amet esse minim elit pariatur voluptate dolor non et. Nulla ad do amet amet mollit duis voluptate magna. Nisi in non cillum amet magna consequat occaecat adipisicing. Ex consequat qui mollit eu exercitation et do adipisicing reprehenderit. Laborum sint eu sit sit ea anim Lorem id ut qui consectetur proident eiusmod laborum. Ipsum aliquip duis fugiat veniam nulla ut.'
          })
        }}
      >
        Open Confirm Dialog
      </button>
    </div>
  )
}

export default App

Open Confirm Dialog as component

As Component

<ConfirmDialog
  anchorElement={
    <div
      style={{
        border: '1px solid black',
        padding: 3,
        marginRight: 20
      }}
    >
      Open Confirm Dialog
    </div>
  }
  title='Dilog Title'
  message='Elit amet esse minim elit pariatur voluptate dolor non et. Nulla ad do amet amet mollit duis voluptate magna. Nisi in non cillum amet magna consequat occaecat adipisicing. Ex consequat qui mollit eu exercitation et do adipisicing reprehenderit. Laborum sint eu sit sit ea anim Lorem id ut qui consectetur proident eiusmod laborum. Ipsum aliquip duis fugiat veniam nulla ut.'
/>

Options For Confirm Dialog

| Name | Type | Description | | --------------------------- | -------------- | ------------------------------------------------------------------------------------- | | title | string or node | Title of dialog | | message | string or node | Message for user to confirm something. | | onClickYes | function | Trigger when use clicked on YES button | | onClickNo | function | Trigger when use clicked on NO button | | yesText | string | To change the text from YES to something else | | noText | string | To change the text from NO to something else | | disableBackdropClick | boolean | Whether to close dialog when user clicks outside (Default-false) | | closeOnButtonClicked | boolean | Whether to close dialog when user clicks any of the button(Yes/NO) (Default-true) | | yesButtonProps | object | Material UI button props | | noButtonProps | object | Material UI button props | | dialogProps | object | Material UI Dialog props | | titleProps | object | Material UI DialogTitle props | | anchorElement | string or node | Anchor Element to hold dialog (Only available when using as a component) | | anchorElementContainerStyle | object | css as a object (Only available when using as a component) | | defaultOpen | boolean | make dialog open by default (Default-false) (Only available when using as a component)|

Open Custom Dialog as function

As Function

import React from 'react'

import { DialogUtils } from 'react-open-dialog'

const App = () => {
  return (
    <div>
      <button
        onClick={() => {
          DialogUtils.openCustomDialog({
            title: 'Custom Dialog',
            customRender: ({ closeDialog }) => {
              return (
                <div>
                  <p>My very first custom dialog </p>
                  <button
                    onClick={() => {
                      closeDialog()
                    }}
                  >
                    Close
                  </button>
                </div>
              )
            }
          })
        }}
      >
        Open Custom Dialog
      </button>
    </div>
  )
}

export default App

Open Confirm Dialog as component

As Component

<CustomDialog
  anchorElement={
    <div style={{ border: '1px solid black', padding: 3 }}>
      Open Custom Dialog
    </div>
  }
  title='Dilog Title'
>
  {({ closeDialog }) => {
    return (
      <div>
        <p>My very first custom dialog </p>
        <button
          onClick={() => {
            closeDialog()
          }}
        >
          Close
        </button>
      </div>
    )
  }}
</CustomDialog>

Options For Custom Dialog

| Name | Type | Description | | --------------------------- | ----------------- | ----------------------------------------------------------------------------- | | title | string or node | Title of dialog | | customRender | callback function | function that returns valid JSX (eg: ({closeDialog})=><div>Hello JSX</div>) | | disableBackdropClick | boolean | Whether to close dialog when user clicks outside (Default-false) | | dialogProps | object | Material UI Dialog props | | titleProps | object | Material UI DialogTitle props | | anchorElement | string or node | Anchor Element to hold dialog (Only available when using as a component)| | anchorElementContainerStyle | object | css as a object (Only available when using as a component)| | defaultOpen | boolean | make dialog open by default (Default-false)(Only available when using as a component)|

Screenshots

Confirm Dialog

Confirm Dialog

Custom Dialog

Custom Dialog

License

MIT © githubprabin143