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

@prmichaelsen/pretty-toasts

v3.0.6

Published

Beautiful gradient toast notifications with Redux and standalone support

Readme

Pretty Toasts

npm version License: MIT Unit Tests Deploy Demo codecov npm downloads Bundle Size

Beautiful gradient toast notifications for React with Redux and standalone support.

Live Demo

🎮 Try the interactive demo: https://prmichaelsen.github.io/pretty-toasts/

Features

  • 🎨 Beautiful Gradient Styling - Purple/indigo for success, purple/rose for error, orange/purple for warning, blue/purple for info
  • 🎨 Custom Theme Support - Customize gradient colors to match your brand
  • 🔄 Redux & Standalone Support - Use with Redux Toolkit or standalone React Context
  • ⏱️ Auto-dismiss with Progress Bar - Configurable duration with visual progress indicator
  • 👆 Interactive Gestures - Swipe/drag to dismiss, hover to pause, click to make permanent
  • 📱 Responsive - Works on desktop and mobile with appropriate positioning
  • 🎭 Smooth Animations - Enter/exit animations with stacking support
  • Accessible - ARIA labels and keyboard support

Installation

npm install @prmichaelsen/pretty-toasts
# or
yarn add @prmichaelsen/pretty-toasts
# or
pnpm add @prmichaelsen/pretty-toasts

Preview

Toast Demo

Peer Dependencies

npm install react react-dom

For Redux support (optional):

npm install @reduxjs/toolkit react-redux

✅ Zero Configuration Required

This library works out of the box with no CSS configuration needed! All styles are included as inline styles, so you don't need Tailwind CSS or any other CSS framework.

Usage

With Redux

  1. Add the toast reducer to your store:
import { configureStore } from '@reduxjs/toolkit';
import toastReducer from 'pretty-toasts/store/toastSlice';

export const store = configureStore({
  reducer: {
    prettyToasts: toastReducer,
    // ... other reducers
  },
});
  1. Add the ToastContainer to your app:
import { ToastContainer } from 'pretty-toasts';

function App() {
  return (
    <>
      {/* Your app content */}
      <ToastContainer />
    </>
  );
}
  1. Use the toast hook:
import { useToast } from 'pretty-toasts';

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

  const handleClick = () => {
    toast.success({
      title: 'Success!',
      message: 'Operation completed successfully',
      duration: 5000,
    });
  };

  return <button onClick={handleClick}>Show Toast</button>;
}

Standalone (without Redux)

  1. Wrap your app with ToastProvider:
import { ToastProvider, ToastContainer } from 'pretty-toasts';

function App() {
  return (
    <ToastProvider>
      {/* Your app content */}
      <ToastContainer />
    </ToastProvider>
  );
}
  1. Use the toast hook:
import { useToast } from 'pretty-toasts';

function MyComponent() {
  const { success, error, warning, info } = useToast();

  return (
    <div>
      <button onClick={() => success({ title: 'Success!', message: 'It worked!' })}>
        Success
      </button>
      <button onClick={() => error({ title: 'Error!', message: 'Something went wrong' })}>
        Error
      </button>
    </div>
  );
}

API

Toast Options

interface ToastOptions {
  id?: string;              // Optional custom ID
  type: ToastType;          // 'success' | 'error' | 'warning' | 'info'
  title: string;            // Toast title
  message?: string;         // Optional message
  duration?: number;        // Duration in ms (default: 10000)
  progress?: number;        // Manual progress 0-100 (for uploads, etc.)
}

useToast Hook

const toast = useToast();

// Generic toast
toast.toast({ type: 'success', title: 'Title', message: 'Message' });

// Convenience methods
toast.success({ title: 'Success!', message: 'Optional message' });
toast.error({ title: 'Error!', message: 'Optional message' });
toast.warning({ title: 'Warning!', message: 'Optional message' });
toast.info({ title: 'Info', message: 'Optional message' });

Manual Progress Updates (for file uploads, etc.)

const uploadId = 'upload-123';

// Start upload toast
toast.info({
  id: uploadId,
  title: 'Uploading...',
  progress: 0,
});

// Update progress
dispatch(updateToast({
  id: uploadId,
  progress: 50,
  message: '50% complete',
}));

// Complete
dispatch(updateToast({
  id: uploadId,
  type: 'success',
  title: 'Upload Complete!',
  progress: 100,
}));

Customization

Custom Theme Colors

You can customize toast gradient colors to match your brand:

import { ToastProvider } from '@prmichaelsen/pretty-toasts/standalone';

const customTheme = {
  toast: {
    success: {
      from: '#10b981', // emerald-500
      to: '#3b82f6',   // blue-500
      opacity: 0.95,
    },
    error: {
      from: '#dc2626', // red-600
      to: '#991b1b',   // red-800
      opacity: 0.95,
    },
    // warning and info will use default colors
  },
};

function App() {
  return (
    <ToastProvider theme={customTheme}>
      <MyApp />
      <StandaloneToastContainer />
    </ToastProvider>
  );
}

Partial Theme Override

You only need to specify the toast types you want to customize:

const partialTheme = {
  toast: {
    success: { from: '#10b981', to: '#3b82f6' },
    // error, warning, info use defaults
  },
};

Dark Mode Example

const darkTheme = {
  toast: {
    success: { from: '#065f46', to: '#047857', opacity: 0.95 },
    error: { from: '#7f1d1d', to: '#991b1b', opacity: 0.95 },
    warning: { from: '#78350f', to: '#92400e', opacity: 0.95 },
    info: { from: '#1e3a8a', to: '#1e40af', opacity: 0.95 },
  },
};

Styling

The library uses inline styles with beautiful gradient colors. No CSS configuration is required - it works out of the box!

All toast styles are self-contained, so you can use this library with any CSS framework (or none at all).

License

MIT