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

notiflow

v1.1.2

Published

A lightweight React notification/toast system with hooks & context

Downloads

375

Readme

notiflow

A lightweight React notification and notification system built with Context and Hooks, allowing you to easily display customizable notifications anywhere in your app.

🌐 Live Demo


📦 Installation

npm install notiflow
# or
yarn add notiflow

Peer Dependencies

  • react (^18 || ^19)
  • react-dom (^18 || ^19)

🚀 Basic Usage

  1. Wrap your app with the provider and add NotificationManager at the root:

    import React from "react";
    import {
      NotificationsProvider,
      useNotifications,
      NotificationManager,
    } from "notiflow";
    
    function App() {
      return (
        <NotificationsProvider>
          <Main />
          <NotificationManager />
        </NotificationsProvider>
      );
    }
    
    function Main() {
      const { notify } = useNotifications();
      return (
        <button
          onClick={() =>
            notify({
              message: "Data saved successfully!",
              type: "success",
              duration: 3000,
            })
          }
        >
          Save Data
        </button>
      );
    }
  2. Anywhere in your component tree, call the useNotifications() hook to send toasts:

    const { notify } = useNotifications();
    
    notify({
      message: "Oops, something went wrong.",
      type: "error",
      duration: 5000,
      hasIcon: true,
      canClose: true,
      subMessage: "Please retry.",
      align: ["bottom", "right"],
    });

⚙️ Global Configuration

To set global defaults, create a config file (recommended naming: notiflow.config.ts):

// notiflow.config.ts

import { setupNotificationConfig, DEFAULT_LIGHT, DEFAULT_DARK } from "notiflow";

setupNotificationConfig({
  defaultMode: "dark", // "light" | "dark"
  colored: "border", // "full" | "border" | "none"
  hasIcon: false, // show icon by default
  canClose: true, // show close button by default
  duration: 7000, // default duration in ms (-1 = stays until manually closed)
  align: ["bottom", "right"], // default position
  lightTheme: {
    ...DEFAULT_LIGHT,
    alert: {
      backgroundColor: "#FFFFFF",
      borderColor: "#FF7777",
      fontColor: "#000000",
    },
  },
  darkTheme: {
    ...DEFAULT_DARK,
    alert: {
      backgroundColor: "#000000",
      borderColor: "#FF7777",
      fontColor: "#FFFFFF",
    },
  },
});

Then, import this config file at the top of your entry file (where you add the provider) to ensure it runs before your app uses the notifications:

import "./notiflow.config.ts";

import React from "react";
import { NotificationsProvider, NotificationManager } from "notiflow";

function App() {
  return (
    <NotificationsProvider>
      <Main />
      <NotificationManager />
    </NotificationsProvider>
  );
}

Note: If duration is set to -1, notifications will remain visible until manually dismissed using the close button or programmatically.


🛠️ API Reference

NotificationsProvider

Wrap this around your app once. It provides the React context for notifications.

<NotificationsProvider>…</NotificationsProvider>

useNotifications()

A hook that returns:

interface UseNotificationsResult {
  notifications: NotificationProps[];
  notify: (options: Omit<NotificationProps, "id" | "isExiting">) => void;
  exitNotification: (id: string) => void;
}
  • notify(options) – creates a new toast.

    • message: string — main text
    • subMessage?: string — secondary text
    • type: 'success' | 'error' | 'info' | 'alert' | 'none'
    • duration: number — milliseconds before auto-dismiss (-1 for persistent)
    • theme?: { borderColor, backgroundColor, fontColor } — custom colors
    • theme?: { borderColor, backgroundColor, fontColor } — custom colors (use hex strings to ensure full opacity/transparency control)
    • hasIcon?: boolean — show default icon
    • customIcon?: ReactNode — render a custom icon or component instead of the default icon
    • onClick?: () => void — callback when toast clicked
    • canClose?: boolean — show manual close button
    • align?: ['top' | 'bottom', 'left' | 'middle' | 'right'] — corner position
    • colored?: 'full' | 'border' | 'none' — color mode
  • exitNotification(id) – manually dismisses a toast (with exit animation).

NotificationManager

Renders all active toasts with stacking, animations, and per-corner grouping. No props required.

<NotificationManager />

🎨 Customization

  • Global defaults: use setupNotificationConfig() to set mode, theme, duration, and other defaults.
  • Theming: pass theme to notify to override border, background, and text colors.
  • Position: control screen corner via align (e.g., ['bottom', 'right']).
  • Icons:
    • Use hasIcon to show default icon shapes.
    • Pass customIcon to render your own icon or JSX element inside the notification.