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

sndp-toast

v1.0.1

Published

Professional toast notifications for React and Next.js

Readme

🔔 SNDP - Professional Toast Notifications

Beautiful, customizable toast notifications for React and Next.js applications.

✨ Features

  • 🎨 5 Toast Types - Success, Error, Warning, Info, Loading
  • 📍 6 Position Options - All corners and centers
  • 🎭 3 Animation Styles - Fade, Slide, Bounce
  • 🌓 Light & Dark Theme - Built-in theme support
  • ⏱️ Auto Close - Customizable duration
  • 🎯 Pause on Hover - Stop timer when hovering
  • 📊 Progress Bar - Visual countdown
  • 🔄 Promise Support - Loading → Success/Error flow
  • 🎬 Custom Actions - Add buttons to toasts
  • Accessible - ARIA roles and keyboard navigation
  • 📦 Lightweight - Minimal bundle size
  • 🚀 SSR Ready - Works with Next.js

📦 Installation

npm install sndp-toast

or

yarn add sndp-toast

🚀 Quick Start

1. Wrap your app with ToastProvider

import { ToastProvider } from 'sndp-toast';

function App() {
  return (
    <ToastProvider>
      <YourApp />
    </ToastProvider>
  );
}

2. Use the useToast hook

import { useToast } from 'sndp-toast';

function MyComponent() {
  const { toast } = useToast();

  return (
    <button onClick={() => toast.success('Success!')}>
      Show Toast
    </button>
  );
}

📖 Usage Examples

Basic Usage

const { toast } = useToast();

// Simple message
toast("Hello World!");

// Different types
toast.success("Operation successful!");
toast.error("Something went wrong!");
toast.warning("Please be careful!");
toast.info("Here's some info");
toast.loading("Processing...");

With Options

toast.success("Saved successfully!", {
  duration: 5000,
  title: "Success",
  showIcon: true,
  closeable: true,
  blur: true
});

Promise-based Toasts

toast.promise(
  fetchData(),
  {
    loading: "Loading data...",
    success: "Data loaded successfully!",
    error: "Failed to load data"
  }
);

With Action Buttons

toast.success("Item deleted", {
  actions: [
    {
      label: "Undo",
      onClick: () => restoreItem(),
      primary: true,
      closeOnClick: true
    },
    {
      label: "Dismiss",
      onClick: () => {},
      closeOnClick: true
    }
  ]
});

Custom Title and Message

toast.success("Operation completed", {
  title: "Success!",
  message: "Your changes have been saved successfully"
});

Update Toast Dynamically

const id = toast.loading("Uploading...");

// Later update it
toast.update(id, {
  type: "success",
  message: "Upload complete!",
  duration: 3000
});

Dismiss Toast

const id = toast.info("Processing...");

// Dismiss it programmatically
toast.dismiss(id);

⚙️ ToastProvider Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | position | string | 'top-right' | Position of toasts (top-left, top-right, top-center, bottom-left, bottom-right, bottom-center) | | maxToasts | number | 5 | Maximum number of toasts to show | | pauseOnHover | boolean | true | Pause auto-close on hover | | animation | string | 'slide' | Animation type (fade, slide, bounce) | | theme | string | 'light' | Theme (light, dark) | | defaultDuration | number | 3000 | Default duration in milliseconds |

🎨 Toast Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | type | string | 'info' | Toast type (success, error, warning, info, loading) | | message | string/React | - | Toast message content | | title | string | - | Optional title | | duration | number | 3000 | Duration in milliseconds (null for no auto-close) | | closeable | boolean | true | Show close button | | showIcon | boolean | true | Show type icon | | showProgress | boolean | true | Show progress bar | | blur | boolean | false | Enable blur effect | | className | string | - | Custom CSS class | | style | object | - | Custom inline styles | | actions | array | - | Action buttons |

🎯 Action Button Props

{
  label: "Button Text",
  onClick: () => {},
  primary: false,
  closeOnClick: true
}

🌈 Next.js Usage

For Next.js, wrap your app in _app.js:

// pages/_app.js
import { ToastProvider } from 'sndp';

function MyApp({ Component, pageProps }) {
  return (
    <ToastProvider position="top-right" theme="light">
      <Component {...pageProps} />
    </ToastProvider>
  );
}

export default MyApp;

🎭 Custom Styling

toast.success("Custom styled toast", {
  className: "my-custom-class",
  style: {
    backgroundColor: "#000",
    color: "#fff"
  }
});

📱 Responsive

SNDP is fully responsive and works great on mobile devices. Toasts automatically adjust their width on smaller screens.

♿ Accessibility

  • ARIA roles for screen readers
  • Keyboard navigation support
  • Appropriate alert levels for different toast types
  • Reduced motion support

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT © sandipan kr bag

🙏 Support

If you like this project, please give it a ⭐ on GitHub!