Skip to content

A simple and easy to use toast notification module for react.

License

Notifications You must be signed in to change notification settings

rohanshukla/react-toast-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-toast-notifier CI status

A simple and easy to use toast notification module for react.

Installation

This is a React.js module available through the npm registry.
Installation is done using the npm install command:

$ npm install react-toast-notifier

Example & Usage (Success)

import React, { Fragment } from 'react';
import Notification, { notifier } from 'react-toast-notifier';

// for success message
const NotificationButton = () => {
  return (
    <Fragment>
      <Notification />
      <button onClick={() => {
        notifier({ type: "success", message: "Success message", autoDismissTimeout:5000 });
      }}>Toast</button>
    </Fragment>
  );
};

export default NotificationButton;

Example & Usage (Error)

import React, { Fragment } from 'react';
import Notification, { notifier } from 'react-toast-notifier';

// for error message
const NotificationButton = () => {
  return (
    <Fragment>
      <Notification />
      <button onClick={() => {
        notifier({ type: "error", message: "Error message", autoDismissTimeout:5000 });
      }}>Toast</button>
    </Fragment>
  );
};

export default NotificationButton;

Example & Usage (Warning)

import React, { Fragment } from 'react';
import Notification, { notifier } from 'react-toast-notifier';

// for warning message
const NotificationButton = () => {
  return (
    <Fragment>
      <Notification />
      <button onClick={() => {
        notifier({ type: "warning", message: "Warning message" });
      }}>Toast</button>
    </Fragment>
  );
};

export default NotificationButton;

Note

  • autoDismissTimeout default time is 4000
  • Available types : ["success", "warning", "error"]

Author

Rohan Shukla GitHub LinkedIn

License

© Licensed under the MIT License.

About

A simple and easy to use toast notification module for react.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published