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-alertify-lite

v1.0.1

Published

A beautiful, animated alert modal component for React with Tailwind CSS. Fully customizable with smooth animations and custom icons.

Readme

react-alertify-lite

A beautiful, animated alert modal component for React with Tailwind CSS. Features smooth animations, multiple alert types, custom icons, and full customization.

npm version bundle size React TypeScript


📘 Table of Contents


🚀 Features

  • 4 Alert Types: Info, Warning, Success, Danger with distinct colors and icons
  • Smooth Animations: Beautiful fade, scale, and bounce effects
  • Custom Icons: Use any icon library for alerts and buttons
  • Responsive Design: Works perfectly on all screen sizes
  • Lightweight: Minimal dependencies, optimized bundle size
  • TypeScript: Full type safety and IntelliSense support
  • Accessible: Keyboard navigation (ESC to close, click outside to dismiss)
  • Loading States: Built-in loading spinner for async operations
  • Flexible Sizing: 5 size options from small to full-screen
  • Framework Support: Works with React and Next.js (App Router & Pages Router)

📦 Installation

npm install react-alertify-lite

or with yarn:

yarn add react-alertify-lite

or with pnpm:

pnpm add react-alertify-lite

🚀 Quick Start

⚛️ React

import { useState } from 'react';
import AlertModal from 'react-alertify-lite';
import 'react-alertify-lite/dist/animations.css';

function App() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <>
      <button onClick={() => setIsOpen(true)}>
        Show Alert
      </button>

      <AlertModal
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        onConfirm={() => {
          console.log('Confirmed!');
          setIsOpen(false);
        }}
        type="danger"
        title="Delete Account"
        message="Are you sure you want to delete your account?"
        description="This action cannot be undone. All your data will be permanently removed."
        confirmText="Delete"
        cancelText="Cancel"
      />
    </>
  );
}

🧭 Next.js (App Router)

Since AlertModal uses client-side features, you need to use it in a Client Component:

import { useState } from 'react';
import AlertModal from 'react-alertify-lite';
import 'react-alertify-lite/dist/animations.css';

export default function Page() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <>
      <button onClick={() => setIsOpen(true)}>
        Show Alert
      </button>

      <AlertModal
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        onConfirm={() => {
          console.log('Confirmed!');
          setIsOpen(false);
        }}
        type="danger"
        title="Delete Account"
        message="Are you sure you want to delete your account?"
        confirmText="Delete"
        cancelText="Cancel"
      />
    </>
  );
}

Or create a separate client component:

import { useState } from 'react';
import AlertModal from 'react-alertify-lite';
import 'react-alertify-lite/dist/animations.css';

export function DeleteButton() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <>
      <button onClick={() => setIsOpen(true)}>Delete</button>
      <AlertModal
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        onConfirm={() => setIsOpen(false)}
        type="danger"
        title="Delete Item"
        message="Are you sure?"
      />
    </>
  );
}

Then use it in your server component:

import { DeleteButton } from '@/components/delete-button';

export default function Page() {
  return (
    <div>
      <h1>My Page</h1>
      <DeleteButton />
    </div>
  );
}

🧭 Next.js (Pages Router)

import { useState } from 'react';
import AlertModal from 'react-alertify-lite';
import 'react-alertify-lite/dist/animations.css';

export default function Home() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <>
      <button onClick={() => setIsOpen(true)}>
        Show Alert
      </button>

      <AlertModal
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        onConfirm={() => setIsOpen(false)}
        type="danger"
        title="Delete Account"
        message="Are you sure?"
      />
    </>
  );
}

💡 Usage Examples

🔔 Basic Alert Types

❌ Danger Alert (Red)

<AlertModal
  isOpen={isOpen}
  onClose={() => setIsOpen(false)}
  onConfirm={handleDelete}
  type="danger"
  title="Delete Item"
  message="This action cannot be undone"
  confirmText="Delete"
/>

⚠️ Warning Alert (Yellow)

<AlertModal
  isOpen={isOpen}
  onClose={() => setIsOpen(false)}
  onConfirm={handleProceed}
  type="warning"
  title="Warning"
  message="Please review before proceeding"
  confirmText="Continue"
/>

✅ Success Alert (Green)

<AlertModal
  isOpen={isOpen}
  onClose={() => setIsOpen(false)}
  onConfirm={handleNext}
  type="success"
  title="Success!"
  message="Your changes have been saved"
  confirmText="OK"
/>

ℹ️ Info Alert (Blue)

<AlertModal
  isOpen={isOpen}
  onClose={() => setIsOpen(false)}
  onConfirm={handleAcknowledge}
  type="info"
  title="Information"
  message="Here's something you should know"
  confirmText="Got it"
/>

🧩 Custom Icons

You can customize the alert icon and add icons to buttons using any icon library:

import { FaRocket } from 'react-icons/fa';
import { IoMdCheckmark, IoMdClose } from 'react-icons/io';

<AlertModal
  isOpen={isOpen}
  onClose={() => setIsOpen(false)}
  onConfirm={handleLaunch}
  type="success"
  title="Launch Ready!"
  message="Your project is ready to deploy"
  description="Click confirm to launch your application to production."
  customIcon={FaRocket}
  confirmIcon={IoMdCheckmark}
  cancelIcon={IoMdClose}
  confirmText="Launch"
  cancelText="Cancel"
/>

⏳ With Loading State

const [isLoading, setIsLoading] = useState(false);

const handleConfirm = async () => {
  setIsLoading(true);
  await performAsyncOperation();
  setIsLoading(false);
  setIsOpen(false);
};

<AlertModal
  isOpen={isOpen}
  onClose={() => setIsOpen(false)}
  onConfirm={handleConfirm}
  type="danger"
  title="Delete Account"
  message="Are you sure?"
  isLoading={isLoading}
  confirmText="Delete"
/>

📏 Different Sizes

// Small
<AlertModal size="sm" {...props} />

// Medium (default)
<AlertModal size="md" {...props} />

// Large
<AlertModal size="lg" {...props} />

// Extra Large
<AlertModal size="xl" {...props} />

// Full Screen
<AlertModal size="full" {...props} />

🧠 API Reference

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | isOpen | boolean | required | Controls modal visibility | | onClose | () => void | required | Called when modal should close | | onConfirm | () => void | required | Called when confirm button is clicked | | type | 'info' \| 'warning' \| 'success' \| 'danger' | 'danger' | Alert type (changes colors and default icon) | | title | string | '' | Modal title text | | message | string | required | Main message text | | description | string | undefined | Additional description text (optional) | | size | 'sm' \| 'md' \| 'lg' \| 'xl' \| 'full' | 'md' | Modal size | | confirmText | string | 'Confirm' | Confirm button text | | cancelText | string | 'Cancel' | Cancel button text | | isLoading | boolean | false | Shows loading spinner on confirm button | | customIcon | React.ComponentType<{ className?: string }> | undefined | Custom icon component for the alert | | confirmIcon | React.ComponentType<{ className?: string }> | undefined | Icon for the confirm button | | cancelIcon | React.ComponentType<{ className?: string }> | undefined | Icon for the cancel button |

🎨 Styling

The component uses Tailwind CSS for styling. Make sure you have Tailwind CSS installed in your project.

💫 Import Animations

Don't forget to import the animations CSS file:

import 'react-alertify-lite/dist/animations.css';

🧵 Custom Styling

You can customize the appearance by overriding the CSS classes or by using Tailwind's configuration.

⚙️ Requirements

  • React 18+ or React 19+
  • Tailwind CSS (for styling)
  • react-icons (included as dependency)

🌐 Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

🪪 License

MIT License - see LICENSE file for details

👨‍💻 Author

Tanvir Faysal

💬 Support

If you find this package helpful, please consider giving it a star on GitHub!

For issues and feature requests, please use the GitHub issues page.