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

react-crisp-toast

v1.1.1

Published

A lightweight toast notification library for React.

Readme

react-crisp-toast 🍞

Version License NPM Downloads

readme

Lightweight toast notification library for React.

Live Demo

Check out the live demo of react-crisp-toast in action: 👉 Demo1: Full Feature 👉 Demo2: Minimal

Features

  • Type-based styling
    Automatically applies styles based on toast types such as success, error, warning, or info.

  • Dynamic positioning
    Display toasts flexibly at the top, bottom, left, right, or center of the screen by specifying vertical and horizontal props.

  • Toast display duration
    Control how long each toast stays visible on the screen.

  • Maximum number of visible toasts
    Limit the number of toasts displayed simultaneously, with a queue system for overflow.

  • Swipe-to-dismiss
    Allows users to manually dismiss toasts with swipe gestures.

  • Sound notifications
    Play sound notifications based on the type of message. Users can customize these sounds.

Installation

Install the library via npm or yarn:

npm install react-crisp-toast
yarn add react-crisp-toast

Usage

To use react-crisp-toast in your project, follow these steps.

1. Wrap your application with the ToastProvider

ToastProvider component manages the state of all toasts and must wrap your application (or a part of it) to provide context.

import { ToastProvider } from "react-crisp-toast";

const App = () => (
  <ToastProvider maxToasts={10}>
    <YourApp />
  </ToastProvider>
);

export default App;

2. Use the useToast hook to add toasts:

import { useToast } from "react-crisp-toast";

const ExampleComponent = () => {
  const { addToast } = useToast();

  const showToast = () => {
    addToast({ message: "This is a toast message!" });
  };

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

API Reference

ToastProvider Props

| Prop | Type | Description | Required | Default | | -------------- | -------- | ----------------------------------------------------------- | ------------ | ----------- | | maxToasts | number | The maximum number of toasts that can be displayed at once. | No | 5 | | soundEnabled | boolean | Whether to enable sound for toast notifications. | No | false |

addToast Parameters

| Name | Type | Description | Required | Default | | --------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------ | ---------------------------------------- | | message | ReactNode | The content/message to be displayed in the toast. | Yes | - | | type | "success" | "error" | "warning" | "info" | The type of the toast. | No | info | | duration | number | How long the toast stays visible. Duration in milliseconds. | No | 3000 | | position | object | The position of the toast on the screen. Accepts an object with vertical and horizontal properties. | No | { vertical: "top", horizontal: "right" } | | position.vertical | "top" | "bottom" | Vertical position of the toast. | No | "top" | | position.horizontal | "left" | "right" | "center" | Horizontal position of the toast. | No | "right" | | showCloseButton | boolean | Whether to display a close button on the toast. | No | false | | soundEnabled | boolean | Whether to play a sound when the toast appears. | No | false |

License

This project is licensed under the MIT License.

Sound Effect

The sound effects used in this project are sourced from the Interface Sounds collection on Pixabay. These sounds are in the public domain and are free to use under the Pixabay Content License.