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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cynzlic/simple-toasts

v1.0.1

Published

Developed as a study project to explore notification systems and animations.

Downloads

121

Readme

React Toast Manager

A library for notifying users about events. It lets you create customizable toasts in four different screen positions, with several animations and additional options for a seamless user experience.

📦 NPM Package:
https://www.npmjs.com/package/@cynzlic/simple-toasts


✨ Features

  • 📍 4 screen positions (left / right × top / bottom)
  • 🎨 Multiple toast types
  • 🎬 In & out animations
  • ⏱ Configurable duration
  • 🎯 Max 3 toasts per position
  • 🧩 Fully typed (TypeScript + Zod)

📦 Installation

npm install @cynzlic/simple-toasts

✨ Quick Start

  1. Install package via npm i @cynzlic/simple-toasts

  2. Wrap your app with <ToastContainer/>

import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.tsx'
import {ToastContainer} from '@cynzlic/simple-toasts'

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <ToastContainer>
          <App />
    </ToastContainer>
  </StrictMode>,
)
  1. Use <ToastManager/> in your app
import "./App.css";
import { ToastManager } from "@cynzlic/simple-toasts";

function App() {
  const showToast = () => {
    ToastManager.Instance.setPosition('left', 'top')
    .setType('info')
    .setTitle('I am a title')
    .setDescription('Hey. I am an info notification')
    .setAnimation('pop', 'zoom-out')
    .setDuration(3000)
    .show();
  };

  return (
      <button onClick={showToast}>show a toast</button>
  );
}

export default App;

ToastManager API

A fluent (chainable) API for creating and displaying toast notifications.


Getting the Instance

const toast = ToastManager.Instance;

Returns the singleton instance of the toast manager.


Methods

setTitle(title: string)

Sets the toast title.

Constraints

  • Must be a non-empty string
  • Maximum 25 characters
toast.setTitle('Success');

setDescription(description: string)

Sets the toast description.

Constraints

  • Must be a non-empty string
  • Maximum 80 characters
toast.setDescription('Operation completed successfully');

setType(type: ToastType)

Sets the toast type.

Available values

  • 'success'
  • 'info'
  • 'warning'
toast.setType('success');

setPosition(horizontal: PositionHorizontal, vertical: PositionVertical)

Sets the toast position on the screen.

Horizontal

  • 'left'
  • 'right'

Vertical

  • 'top'
  • 'bottom'

Valid combinations

  • ('left', 'top')
  • ('right', 'top')
  • ('left', 'bottom')
  • ('right', 'bottom')

⚠️ Maximum 3 toasts per position at the same time

toast.setPosition('right', 'bottom');

setAnimation(animationIn: ToastInAnimation, animationOut?: ToastOutAnimation)

Sets the toast animations.

In animations (animationIn)

  • 'slide'
  • 'pop'
  • 'fade-in-rotate'
  • 'bounce'
  • 'zoom-blur-in'

Out animations (animationOut, optional)

  • 'vanish'
  • 'rotate-out'
  • 'zoom-out'
  • 'pop-out'
toast.setAnimation('slide');

toast.setAnimation('pop', 'zoom-out');

setDuration(duration: number)

Sets how long the toast is displayed (in milliseconds).

Rules

  • Must be a positive number
  • If not set, the toast will not disappear automatically
toast.setDuration(3000);

setBackground(color: string)

Sets a custom background color for the toast.

toast.setBackground('#1e293b');

show()

Creates and displays the toast.

toast.show();

Full Usage Example

ToastManager.Instance
  .setTitle('Success')
  .setDescription('Operation completed successfully')
  .setType('success')
  .setPosition('right', 'bottom')
  .setAnimation('pop', 'zoom-out')
  .setDuration(3000)
  .setBackground('#1e293b')
  .show();

Default Values

If no options are provided, the following defaults are used:

{
  title: 'Info',
  description: 'Description',
  type: 'info',
  position: ['right', 'top'],
  animation: ['slide', 'pop-out'],
  duration: 0
}

Type Definitions

type ToastType = 'success' | 'info' | 'warning';

type PositionHorizontal = 'left' | 'right';
type PositionVertical = 'top' | 'bottom';

type ToastInAnimation =
  | 'slide'
  | 'pop'
  | 'fade-in-rotate'
  | 'bounce'
  | 'zoom-blur-in';

type ToastOutAnimation =
  | 'vanish'
  | 'rotate-out'
  | 'zoom-out'
  | 'pop-out';