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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@leafygreen-ui/confirmation-modal

v5.2.1

Published

leafyGreen UI Kit Confirmation Modal

Downloads

169,331

Readme

Confirmation Modal

npm (scoped)

View on MongoDB.design

Installation

Yarn

yarn add @leafygreen-ui/confirmation-modal

NPM

npm install @leafygreen-ui/confirmation-modal

Example

import ConfirmationModal from '@leafygreen-ui/confirmation-modal';

function ExampleComponent() {
  const [open, setOpen] = useState(false);

  return (
    <>
      <button onClick={() => setOpen(!open)}>Open Modal</button>
      <ConfirmationModal
        open={open}
        confirmButtonProps={{
          children: 'confirm',
          onClick: () => setOpen(false),
          disabled: true,
        }}
        cancelButtonProps={{
          onClick: () => setOpen(false),
          variant: 'default',
        }}
        title="Confirm Title Here"
        requiredInputText="confirm"
      >
        This is some description text, and it is extra long so it fills up this
        modal. Another thing about the modals here. This is some description
        text, and it is extra long so it fills up this modal. Another thing
        about the modals here.
      </ConfirmationModal>
    </>
  );
}

Properties

| Prop | Type | Description | Default | | ---------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | | confirmButtonProps | ButtonProps | The confirm button on the right. An object that accepts all Button props except variant. The variant of the confirm button is controlled by the variant prop. The text is confirm by default but can by overridden with the children property. | | | cancelButtonProps | ButtonProps | The cancel button on the left. An object that accepts all Button props. except children. The text will always render cancel and the onClick property will also fire when the X button, or backdrop is clicked. | | | open | boolean | Determines open state of Modal component | false | | title | string | Title text to display above the main content text. | | | children | node | Children that will be rendered inside <ConfirmationModal /> component. | | | variant | 'default', 'danger' | Sets the style variant. | 'default' | | requiredInputText | string | If provided, a text prompt will be displayed and the confirmation button will be disabled until the text prompt is filled out with the required text. | | | className | string | Style to be applied to the container's root node. | | | darkMode | boolean | Determines if the component will appear in dark mode. | false | | onConfirm(Deprecated) | function | Callback that fires when the action is confirmed. This can be used to set the modal to be closed. @deprecated - use confirmButtonProps and pass the onClick property | () => {} | | buttonText(Deprecated) | string | Text content of the confirmation button. @deprecated - use confirmButtonProps and pass the children property. | | | submitDisabled(Deprecated) | boolean | Determines if the submit button should appear as disabled @deprecated - use confirmButtonProps and pass the disabled property | false | | onCancel(Deprecated) | function | Callback that fires when the cancel button, x button, or backdrop is clicked. This can be used to set the modal to be closed. @deprecated - use cancelButtonProps and pass the onClick property | () => {} |