New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pro-react-toast

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pro-react-toast

A professional React toast notification library with TypeScript support, themes, and animations

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

💎 Pro React Toast 💎

A professional React toast notification library with TypeScript support, multiple themes, position control, and smooth animations.

npm version License: MIT TypeScript

✨ Features

  • 🎨 Theme Support - Light, dark, and custom themes
  • 📍 9 Positions - Place toasts anywhere on screen
  • 🎯 TypeScript - Full type safety and IntelliSense
  • 🔧 Customizable - Icons, duration, styling and more
  • Performance - Optimized animations and rendering
  • 📱 Responsive - Works great on all devices
  • 🔒 Type Safe - Built with TypeScript from ground up
  • 🎪 Animations - Smooth enter/exit animations
  • 🎛️ Stack Control - Limit maximum toasts shown
  • ⏱️ Auto Dismiss - Configurable auto-close with progress bar
  • 🧩 Easy to Use – Simple and powerful flexibility

🚀 Live Demo

🚀 Documentation

  • Coming Soon...

📦 Installation

npm install pro-react-toast
# or
yarn add pro-react-toast
# or
pnpm add pro-react-toast

🚀 Quick Start

1. Wrap your app with ToastProvider

import { ToastProvider, ToastContainer } from "pro-react-toast";

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

2. Use the useToast hook

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

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

  const showSuccessToast = () => {
    toast.success("Wow Operation completed successfully!");
  };

  const showCustomToast = () => {
    toast.custom("Custom message with icon!", {
      icon: <span>🚀</span>,
      position: "bottom-right",
      theme: "dark",
      duration: 5000,
    });
  };

  return (
    <div>
      <button onClick={showSuccessToast}>Success</button>
      <button onClick={showCustomToast}>Custom</button>
    </div>
  );
}

📖 API Reference

ToastProvider Props

PropTypeDefaultDescription
childrenReactNode-Your app content
maxToastsnumber10Maximum number of toasts to keep in memory

ToastContainer Props

PropTypeDefaultDescription
maxToastsnumber5Maximum toasts to display simultaneously
positionToastPosition'top-right'Default position for toasts
themeToastTheme'light'Default theme for toasts
classNamestring''Custom CSS class

Toast Options

OptionTypeDefaultDescription
durationnumber4000Auto-dismiss time in ms (0 = no auto-dismiss)
positionToastPosition'top-right'Toast position
themeToastTheme'light'Toast theme
iconReactNodeundefinedCustom icon component
closablebooleantrueShow close button
classNamestring''Custom CSS class
styleCSSProperties{}Inline styles

Toast Positions

type ToastPosition =
  | "top-left"
  | "top-center"
  | "top-right"
  | "middle-left"
  | "middle-center"
  | "middle-right"
  | "bottom-left"
  | "bottom-center"
  | "bottom-right";

Toast Themes

type ToastTheme = "light" | "dark" | "custom";

useToast Hook

const { toast, clearAll } = useToast();

// Toast methods
toast.success(message, options?)
toast.error(message, options?)
toast.warning(message, options?)
toast.info(message, options?)
toast.custom(message, options?)

// Clear all toasts
clearAll()

🎨 Customization

Custom Themes

You can customize toast appearance using CSS variables:

:root {
  --toast-bg-success: #10b981;
  --toast-bg-error: #ef4444;
  --toast-bg-warning: #f59e0b;
  --toast-bg-info: #3b82f6;
  --toast-bg-custom: #8b5cf6;
  --toast-text-color: #ffffff;
  --toast-border-radius: 8px;
  --toast-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

Custom Icons

import { CustomIcon } from "./icons";

toast.success("Success!", {
  icon: <CustomIcon />,
});

Custom Styling

toast.info("Styled toast", {
  className: "my-custom-toast",
  style: {
    background: "linear-gradient(45deg, #667eea, #764ba2)",
  },
});

🌟 Advanced Examples

Promise-based Toasts

const handleAsyncOperation = async () => {
  try {
    toast.info("Processing...", { duration: 0 });
    await someAsyncOperation();
    clearAll();
    toast.success("Wow My Operation completed!");
  } catch (error) {
    clearAll();
    toast.error("Ohhh My Operation failed!");
  }
};

Notification Center

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

  const notifications = [
    { type: "success", message: "Profile updated" },
    { type: "info", message: "New message received" },
    { type: "warning", message: "Storage almost full" },
  ];

  const showAll = () => {
    notifications.forEach((notif, index) => {
      setTimeout(() => {
        toast[notif.type](notif.message);
      }, index * 500);
    });
  };

  return <button onClick={showAll}>Show Notifications</button>;
}

🛠️ Development

# Install dependencies
npm install

# Build the package
npm run build

# Start demo in development
npm run demo:dev

# Build demo for production
npm run demo:build

📝 TypeScript Support

This package is built with TypeScript and provides full type safety:

import { ToastOptions, ToastPosition, ToastTheme } from "pro-react-toast";

const options: ToastOptions = {
  duration: 5000,
  position: "top-left",
  theme: "dark",
  closable: true,
};

🤝 Contributing

At pro-react-toast, we believe in building with the community. Have an idea, improvement, or feature request? We’re all ears!

We welcome feedback, discussions, and collaboration to make the package more powerful and flexible for everyone.

📄 License

licensed under the MIT

Made with ❤️ by Biren Gohel

Keywords

react

FAQs

Package last updated on 18 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts