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

popupz

v3.2.5

Published

A simple and customizable popup notification library for React applications.

Downloads

26

Readme

Popupz 🍿

Popupz is a simple and customizable popup notification library for React applications. It provides an easy way to display success, error, warning, info, or default messages to users with customizable themes and message content.

Installation

To install Popupz, you can use npm:

npm install popupz

Usage

  1. Integration in main.jsx

    Wrap your App.jsx component with the PopzProvider to enable the pop-up notifications. Your main.jsx should be structured as follows:

    import React from 'react'
    import ReactDOM from 'react-dom/client'
    import App from './App.jsx'
    import './index.css'
    import { PopzProvider } from 'popupz';
      
    ReactDOM.createRoot(document.getElementById('root')).render(
      <React.StrictMode>
        <PopzProvider>
          <App />
        </PopzProvider>
      </React.StrictMode>,
    )
    
  2. Custom Pop-Up Positioning

    Pop-up positioning is crucial for a seamless user experience. You can choose from options like top-left (tl), top-right (tr), bottom-left (bl), and bottom-right (br) to strategically place notifications. Adding a position prop to the PopzProvider component allows users to customize pop-up placement. If no position is specified, pop-ups default to the top-right corner for consistency.

      <PopzProvider position='tl'>
        <App />
      </PopzProvider>
  3. Displaying Popup Notifications

    To display popup notifications, first import the usePopz hook in your component.

      import { usePopz } from 'popupz';

    Now use the popz function provided by the usePopz hook. The function accepts four parameters: theme, type, message, and progressBar.

//syntax- popz(theme, type, message, progress-bar);
  • theme: Specify the theme of the popup. It can be either 'dark' or 'light'.
  • type: Specify the type of message. Available options are 'success', 'error', 'warning', 'info', or 'default'.
  • message: Provide a short informative message to display in the popup.
  • progressBar: Specify whether to display a progress bar along with the popup. Use 'true' to show the progress bar and 'false' to hide it.

Example usage:

import React from 'react';
import { usePopz } from 'popupz';

const MyComponent = () => {
  const { popz } = usePopz();

  const handleSubmit = () => {
    // your logic
    popz('dark', 'success', 'Logged in Successfully!', 'true');
  };

  return (
    <div>
      <h1>My Component</h1>
      <button onClick={handleSubmit} >
        Submit
      </button>
    </div>
  );
};

export default MyComponent;

In this example, clicking the submit button triggers the display of a success popup notification with a dark theme, displaying the message "Logged in Successfully!" and including a progress bar.