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-confirm-alert

v3.3.0

Published

react component confirm dialog.

Readme

react-confirm-alert

Confirm, alert and prompt dialogs for React 18 and 19. await confirm(), a native modal, focus that moves in and back, and the 3.0 confirmAlert unchanged.

npm version

Docs · Playground · What's new in 3.1

Install

npm install react-confirm-alert

Ask a question

import { confirm } from 'react-confirm-alert'
import 'react-confirm-alert/style.css'

if (await confirm({ title: 'Delete file?', message: 'This cannot be undone.', tone: 'danger' })) {
  remove(file)
}

style.css needs 3.1.1 or later. The older path, react-confirm-alert/src/react-confirm-alert.css, still works.

confirm() resolves true or false. alert() and prompt() work the same way, and <DialogHost /> placed inside your providers lets dialogs read their context.

Custom UI

Put your own form, list or warning in a dialog. Plain HTML gets the default look, even under Tailwind v4 preflight, and any class you add wins:

import { DialogLayout, openDialog } from 'react-confirm-alert'

const colour = await openDialog({
  render: ({ close, dismiss }) => (
    <DialogLayout title="Pick a colour" actions={[{ label: 'Cancel', onClick: dismiss }, { label: 'Blue', variant: 'primary', onClick: () => close('blue') }]}>
      <p>Used for the team badge.</p>
    </DialogLayout>
  )
}).result

3.0 customUI still works. Add skin: true for the new look:

confirmAlert({
  skin: true,
  customUI: ({ onClose }) => (
    <>
      <h1>Leave the board?</h1>
      <p>You can join again from the invite link.</p>
      <button onClick={onClose}>Stay</button>
    </>
  )
})

confirm, alert and prompt take content for JSX between the message and the buttons. See Custom UI.

3.0 code keeps working

import { confirmAlert } from 'react-confirm-alert'
import 'react-confirm-alert/style.css'

confirmAlert({
  title: 'Confirm to submit',
  message: 'Are you sure to do this.',
  buttons: [
    { label: 'Yes', onClick: () => alert('Click Yes') },
    { label: 'No', onClick: () => alert('Click No') }
  ]
})

Same options, DOM, class names and CSS path as 3.0.

Tailwind CSS

@import 'tailwindcss';
@import 'react-confirm-alert/style.css' layer(components);
confirm({ title: 'Publish?', classNames: { button: 'rounded-full bg-red-500' } })

Importing the CSS into layer(components) lets Tailwind utilities win without !important. Or pass unstyled: true and style every slot yourself.

Size

| Import | gzip | |---|---| | import { confirmAlert } | 3,769 B | | import { confirm } | 4,042 B | | CSS (the shipped file, not minified) | 2,909 B |

Measured on 2026-10-23 with size-limit 14.3.0 (npx size-limit, config in .size-limit.json): the ESM build bundled and minified with React and React DOM excluded, then gzipped. 3.0.6 measured the same way is 2,396 B, including prop-types. The extra bytes are the native modal, focus handling, stacked and queued dialogs, dialogs that render inside your providers, and the default look for your own content.

Older versions

Docs for v1 and v2. For React 17 or older, use version 2.

License

MIT