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

no-confirmation-box

v0.1.0

Published

A modern confirmation dialog where the No button dodges clicks

Readme

No Confirmation Box

A modern confirmation dialog package where the No button keeps slipping away so the Yes choice is the only sensible option.

Usage

import { createNoConfirmationBox } from 'no-confirmation-box'
import 'no-confirmation-box/styles.css'

createNoConfirmationBox({
  title: 'Continue?',
  text: 'Do you want to proceed with the next step?',
  icon: '!',
  button1Text: 'No thanks',
  button2Text: 'Continue',
  onYes: () => console.log('Confirmed')
})

React

import { useState } from 'react'
import { NoConfirmationBox } from 'no-confirmation-box/react'
import 'no-confirmation-box/styles.css'

export function DangerousAction() {
  const [open, setOpen] = useState(false)

  return (
    <>
      <button type="button" onClick={() => setOpen(true)}>
        Open dialog
      </button>

      <NoConfirmationBox
        open={open}
        icon="!"
        title="Continue?"
        text="The first button runs away. The second button confirms."
        button1Text="No thanks"
        button2Text="Continue"
        onButton1Attempt={() => console.log('No was attempted')}
        onButton2={() => console.log('Confirmed')}
        onClose={() => setOpen(false)}
      />
    </>
  )
}

For an uncontrolled dialog, render it conditionally and let it close itself:

{showDialog && (
  <NoConfirmationBox
    title="Install update?"
    text="You can configure all content and styling from props."
    button1Text="Skip"
    button2Text="Install"
    onClose={() => setShowDialog(false)}
  />
)}

Configuration

createNoConfirmationBox({
  icon: '!?',
  title: 'Delete everything?',
  text: 'The first button runs away. The second button confirms.',
  button1Text: 'No',
  button2Text: 'Yes',
  closeOnOverlayClick: true,
  className: 'my-confirmation-overlay',
  dialogClassName: 'my-confirmation-dialog',
  styles: {
    overlay: {
      '--ncb-overlay-background': 'rgba(0, 0, 0, 0.7)'
    },
    dialog: {
      maxWidth: '480px'
    },
    icon: {
      background: 'linear-gradient(135deg, #ffbf47, #ff5c7a)'
    },
    button1: {
      background: '#e44'
    },
    button2: {
      background: '#0a7'
    }
  },
  onButton1Attempt: () => console.log('No was attempted'),
  onButton2: ({ destroy }) => console.log('Confirmed')
})

Options:

  • title: dialog title text or a DOM node.
  • text / message: body text or a DOM node.
  • icon: icon text or a DOM node. Use false to hide it.
  • button1Text / noLabel: evasive button text.
  • button2Text / yesLabel: clickable confirmation button text.
  • onButton1Attempt / onNoAttempt: called when the user tries to press the evasive button.
  • onButton2 / onYes: called when the confirmation button is clicked.
  • closeOnOverlayClick: set to false to prevent closing from the backdrop.
  • className, dialogClassName, iconClassName, titleClassName, messageClassName, actionsClassName, button1ClassName, button2ClassName: extra CSS classes.
  • style / dialogStyle: inline styles for the dialog.
  • overlayStyle, iconStyle, titleStyle, messageStyle, actionsStyle, button1Style, button2Style: inline styles for specific parts.
  • styles: grouped style object with overlay, dialog, icon, title, message, actions, button1, and button2 keys.
  • container: element to append the dialog into. Defaults to document.body.

React-only options:

  • open: controls visibility when provided.
  • children: custom body content, used instead of text / message when provided.
  • closeOnButton2: defaults to true. Set to false if the parent should close the dialog manually.

Features

  • Modern glassy card UI
  • No button moves before the pointer can hover or click it
  • Yes button stays prominent and clickable
  • Configurable icon, title, text, button labels, classes, callbacks, and styles
  • Works with plain JavaScript, React, and any module-based app