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

toastybyte

v1.1.0

Published

A modern, professional toast notification library for React and Next.js

Readme

ToastyByte

A modern, professional toast notification library for React and Next.js with zero dependencies.

Features

  • Zero Dependencies: No external CSS frameworks or animation libraries required - pure CSS animations
  • 14 Design Presets: Modern, Minimal, Neomorphic, Playful, Brutalist, Premium, Gradient, Outlined, Terminal, 3D, Cyberpunk, Oldschool, Steampunk, and Pastel
  • 3 Size Variants: Small, medium, and large toast sizes with responsive scaling
  • Light & Dark Themes: Manual control about design presets based on the project fitting
  • Fully Responsive: Auto-centers on mobile devices, respects positioning on desktop
  • Multiple Positions: Display toasts in 6 different positions (top/bottom × left/center/right)
  • 4 Variants: Pre-styled success, error, warning, and info toasts with icons
  • 12 Transitions: Slide, fade, scale, bounce, flip, zoom, blur, swing, rotate, elastic, drop, and roll animations
  • Description Field: Add secondary text below the main message for detailed context
  • Font Sizing System: Predefined size scale (xs-xxl) with separate title/description control
  • Auto-dismiss: Configurable duration with automatic removal and pause on hover
  • Progress Bar: Visual countdown indicator
  • TypeScript: Full type safety with exported types
  • Compatibility: Compatible with React and Next.js

Installation

npm install toastybyte
# or
yarn add toastybyte
# or
pnpm add toastybyte

Setup

1. Import the CSS

The components needs to be imported once in your application. Choose the method that works best for your setup:

Next.js App Router (app/layout.tsx)

import { ToastProvider, ToastContainer } from 'toastybyte';
import 'toastybyte/styles.css';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <ToastProvider>
          {children}
          <ToastContainer />
        </ToastProvider>
      </body>
    </html>
  );
}

Next.js Pages Router (pages/_app.tsx)

import { ToastProvider, ToastContainer } from 'toastybyte';
import 'toastybyte/styles.css';
import type { AppProps } from 'next/app';

export default function App({ Component, pageProps }: AppProps) {
  return (
    <ToastProvider>
      <Component {...pageProps} />
      <ToastContainer />
    </ToastProvider>
  );
}

React (main.tsx / index.tsx)

import { ToastProvider, ToastContainer } from 'toastybyte';
import 'toastybyte/styles.css';
import ReactDOM from 'react-dom/client';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <ToastProvider>
    <App />
    <ToastContainer />
  </ToastProvider>
);

Usage

Basic Usage

'use client'; // Add this for Next.js App Router

import { useToast } from 'toastybyte';

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

  return (
    <div>
      <button onClick={() => success('Operation successful!')}>
        Success Toast
      </button>
      <button onClick={() => error('Something went wrong!')}>
        Error Toast
      </button>
      <button onClick={() => warning('Be careful!')}>
        Warning Toast
      </button>
      <button onClick={() => info('Here is some info')}>
        Info Toast
      </button>
    </div>
  );
}

Design Presets & Themes

const { success } = useToast();

// Use a specific design preset
success('Payment successful!', {
  design: 'cyberpunk', // or 'modern', 'brutalist', 'pastel', etc.
  theme: 'dark', // 'light', 'dark', or 'auto'
});

// Different designs showcase
success('Modern design', { design: 'modern' });
success('Minimal design', { design: 'minimal' });
success('Neomorphic design', { design: 'neomorphic' });
success('Playful design', { design: 'playful' });
success('Brutalist design', { design: 'brutalist' });
success('Premium design', { design: 'premium' });
success('Gradient design', { design: 'gradient' });
success('Outlined design', { design: 'outlined' });
success('Terminal design', { design: 'terminal' });
success('3D design', { design: 'threed' });
success('Cyberpunk design', { design: 'cyberpunk' });
success('Oldschool design', { design: 'oldschool' });
success('Steampunk design', { design: 'steampunk' });
success('Pastel design', { design: 'pastel' });

Custom Position

const { success } = useToast();

success('Saved!', {
  position: 'bottom-right', // or 'top-left', 'top-center', etc.
});

Custom Transitions

const { info } = useToast();

// Different animation transitions
info('Slide animation', { transition: 'slide' });
info('Fade animation', { transition: 'fade' });
info('Scale animation', { transition: 'scale' });
info('Bounce animation', { transition: 'bounce' });
info('Flip animation', { transition: 'flip' });
info('Zoom animation', { transition: 'zoom' });
info('Blur animation', { transition: 'blur' });
info('Swing animation', { transition: 'swing' });
info('Rotate animation', { transition: 'rotate' });
info('Elastic animation', { transition: 'elastic' });
info('Drop animation', { transition: 'drop' });
info('Roll animation', { transition: 'roll' });

Custom Duration

const { info } = useToast();

// Show for 3 seconds
info('Quick message', { duration: 3000 });

// Show indefinitely (manual dismiss only)
info('Sticky message', { duration: 0 });

Toast Sizes

Choose from three size variants:

const { success } = useToast();

// Small size
success('Compact message', { size: 'sm' });

// Medium size (default)
success('Standard message', { size: 'md' });

// Large size
success('Prominent message', { size: 'lg' });

Description Field

Add secondary text below the main message:

const { success, error } = useToast();

// Success with description
success('Upload Complete', {
  description: 'Your file has been uploaded successfully and is now processing',
});

// Error with detailed description
error('Connection Failed', {
  description: 'Unable to connect to the server. Please check your internet connection and try again.',
});

// Info with description
info('New Update Available', {
  description: 'Version 2.0 is ready to install. Click here to update now.',
});

Advanced Example

const { toast } = useToast();

// Full control with all options
toast('Complex notification', {
  variant: 'success',
  description: 'Your changes have been saved successfully',
  position: 'top-center',
  duration: 5000,
  design: 'premium',
  theme: 'dark',
  transition: 'bounce',
  showProgressBar: true,
  showCloseButton: true,
  pauseOnHover: true,
});

API Reference

useToast()

Returns an object with the following methods:

  • toast(message, options?) - Show a toast with full control
  • success(message, options?) - Show a success toast
  • error(message, options?) - Show an error toast
  • warning(message, options?) - Show a warning toast
  • info(message, options?) - Show an info toast

Options

interface ToastOptions {
  variant?: 'success' | 'error' | 'warning' | 'info';
  position?: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
  duration?: number; // milliseconds, 0 for no auto-dismiss
  design?: 'modern' | 'minimal' | 'neomorphic' | 'playful' | 'brutalist' | 'premium' | 'gradient' | 'outlined' | 'terminal' | 'threed' | 'cyberpunk' | 'oldschool' | 'steampunk' | 'pastel';
  theme?: 'light' | 'dark' | 'auto';
  size?: 'sm' | 'md' | 'lg';
  transition?: 'slide' | 'fade' | 'scale' | 'bounce' | 'flip' | 'zoom' | 'blur' | 'swing' | 'rotate' | 'elastic' | 'drop' | 'roll';
  description?: string;
  icon?: React.ReactNode;
  showProgressBar?: boolean;
  showCloseButton?: boolean;
  pauseOnHover?: boolean;
  style?: ToastStyle; // Custom styling
}

Positions

ToastyByte supports 6 positions:

  • top-left
  • top-center
  • top-right
  • bottom-left
  • bottom-center
  • bottom-right (default)

Variants

  • success: Green with checkmark icon
  • error: Red with X icon
  • warning: Yellow with warning icon
  • info: Blue with info icon (default)

Design Presets

ToastyByte includes 14 designed presets:

  1. modern - Sleek glassmorphism with gradients
  2. minimal - Clean and simple
  3. neomorphic - Soft 3D shadows
  4. playful - Fun and colorful
  5. brutalist - Bold and stark
  6. premium - Elegant and luxurious
  7. gradient - Vibrant gradients
  8. outlined - Transparent with borders
  9. terminal - Developer-inspired
  10. threed - Elevated with shadows
  11. cyberpunk - Neon futuristic
  12. oldschool - Retro vibes
  13. steampunk - Vintage industrial
  14. pastel - Soft and gentle

Custom Styling

You can customize individual toasts with custom styles:

success('Custom styled toast', {
  style: {
    borderRadius: '0.5rem',
    backdropBlur: 'lg',
    colors: {
      background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
      border: '#667eea',
      text: '#ffffff',
    },
    font: {
      family: 'monospace',
      size: '16px',
      weight: 600,
    },
  },
});

Font Sizing System

ToastyByte includes a predefined font size scale that you can use for consistent typography:

const { success, info } = useToast();

// Use predefined sizes: xs, sm, md, lg, xl, xxl
success('Large Title', {
  style: {
    font: {
      titleSize: 'xl',        // Extra large title
      descriptionSize: 'md',  // Medium description
    },
  },
});

// Separate control for title and description
info('Custom Typography', {
  description: 'This description is extra small',
  style: {
    font: {
      titleSize: 'lg',        // 16px
      descriptionSize: 'xs',  // 10px
    },
  },
});

// Or use custom values
success('Custom Sizes', {
  description: 'With custom pixel values',
  style: {
    font: {
      titleSize: '20px',      // Custom pixel value
      descriptionSize: '1rem', // Custom rem value
      weight: 700,
    },
  },
});

// Available predefined sizes:
// xs   = 10px
// sm   = 12px (default for description)
// md   = 14px (default for title)
// lg   = 16px
// xl   = 18px
// xxl  = 20px

Advanced Font Customization

success('Stylized Text', {
  description: 'With text stroke effect',
  style: {
    font: {
      family: '"Comic Sans MS", cursive',
      titleSize: 'xxl',
      descriptionSize: 'sm',
      weight: 900,
      strokeWidth: '1px',      // Text outline
      strokeColor: '#000000',  // Outline color
    },
  },
});

TypeScript

ToastyByte is written in TypeScript and includes full type definitions. All types are exported:

import type {
  Toast,
  ToastVariant,
  ToastPosition,
  ToastOptions,
  ToastTransition,
  ToastTheme,
  DesignType,
  ToastSize
} from 'toastybyte';

Browser Support

ToastyByte works in all modern browsers that support ES2020:

  • Chrome/Edge 80+
  • Firefox 72+
  • Safari 13.1+
  • Opera 67+

License

MIT