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

v1.0.4

Published

A lightweight and customizable React notification library with TypeScript support. Features multiple notification types, 6 positioning options, auto-dismiss, and smooth animations.

Readme

react-notify-lite

A lightweight and customizable React notification library with TypeScript support.

Features

  • Lightweight and fast
  • TypeScript support
  • Multiple notification types (success, error, warning, info)
  • Customizable positioning (6 positions)
  • Auto-dismiss with configurable duration
  • Smooth animations
  • Easy to use API
  • Zero dependencies (except React)

Installation

npm install react-notify-lite

or

yarn add react-notify-lite

Usage

1. Wrap your app with ToastProvider

import React from 'react';
import { ToastProvider } from 'react-notify-lite';
import 'react-notify-lite/dist/styles.css';

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

export default App;

2. Use the useNotify hook in your components

import React from 'react';
import { useNotify } from 'react-notify-lite';

function MyComponent() {
  const notify = useNotify();

  const handleClick = () => {
    // Basic notification
    notify.info('This is an info message');

    // Success notification
    notify.success('Operation completed successfully!');

    // Error notification
    notify.error('Something went wrong!');

    // Warning notification
    notify.warning('This is a warning message');

    // Custom options
    notify.info('Custom notification', {
      duration: 5000,
      position: 'top-center',
    });
  };

  return (
    <button onClick={handleClick}>
      Show Notification
    </button>
  );
}

API

ToastProvider

Wrap your application with ToastProvider to enable notifications throughout your app.

<ToastProvider>
  {children}
</ToastProvider>

useNotify Hook

The useNotify hook returns an object with the following methods:

notify(message, options?)

Display a notification with custom options.

notify.notify('Message', {
  type: 'info',
  duration: 3000,
  position: 'top-right',
});

success(message, options?)

Display a success notification.

notify.success('Success message', {
  duration: 3000,
  position: 'top-right',
});

error(message, options?)

Display an error notification.

notify.error('Error message', {
  duration: 3000,
  position: 'top-right',
});

warning(message, options?)

Display a warning notification.

notify.warning('Warning message', {
  duration: 3000,
  position: 'top-right',
});

info(message, options?)

Display an info notification.

notify.info('Info message', {
  duration: 3000,
  position: 'top-right',
});

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | type | 'success' \| 'error' \| 'warning' \| 'info' | 'info' | Type of notification | | duration | number | 3000 | Duration in milliseconds before auto-dismiss | | position | 'top-left' \| 'top-right' \| 'top-center' \| 'bottom-left' \| 'bottom-right' \| 'bottom-center' | 'top-right' | Position of the notification |

Positions

The library supports 6 different positions:

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

Customization

You can customize the styles by overriding the CSS classes:

/* Override toast styles */
.toast {
  /* Your custom styles */
}

.toast-success {
  /* Custom success styles */
}

.toast-error {
  /* Custom error styles */
}

.toast-warning {
  /* Custom warning styles */
}

.toast-info {
  /* Custom info styles */
}

TypeScript

This library is written in TypeScript and includes type definitions.

import { ToastType, ToastOptions, Toast } from 'react-notify-lite';

Examples

Multiple Notifications

function Example() {
  const notify = useNotify();

  const showMultiple = () => {
    notify.success('First notification');
    notify.info('Second notification');
    notify.warning('Third notification');
  };

  return <button onClick={showMultiple}>Show Multiple</button>;
}

Different Positions

function Example() {
  const notify = useNotify();

  const showAtPosition = (position: string) => {
    notify.success(`Notification at ${position}`, { position });
  };

  return (
    <div>
      <button onClick={() => showAtPosition('top-left')}>Top Left</button>
      <button onClick={() => showAtPosition('top-right')}>Top Right</button>
      <button onClick={() => showAtPosition('bottom-center')}>Bottom Center</button>
    </div>
  );
}

Custom Duration

function Example() {
  const notify = useNotify();

  const showLongNotification = () => {
    notify.info('This will stay for 10 seconds', { duration: 10000 });
  };

  return <button onClick={showLongNotification}>Show Long Notification</button>;
}

License

MIT

Contributing

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

Issues

If you find a bug or have a feature request, please open an issue on GitHub.