All Projects → jesusoterogomez → React Notify Toast

jesusoterogomez / React Notify Toast

Toast notifications for React.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Notify Toast

React Toast Notifications
🍞 A toast notification system for react
Stars: ✭ 2,103 (+1094.89%)
Mutual labels:  notifications, toast
Burnttoast
Module for creating and displaying Toast Notifications on Microsoft Windows 10.
Stars: ✭ 796 (+352.27%)
Mutual labels:  notifications, toast
Vue Snotify
Vuejs 2 Notification Center
Stars: ✭ 755 (+328.98%)
Mutual labels:  notifications, toast
Toastify Js
Pure JavaScript library for better notification messages
Stars: ✭ 570 (+223.86%)
Mutual labels:  notifications, toast
Notiflix
Notiflix is a JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more that makes your web projects much better.
Stars: ✭ 172 (-2.27%)
Mutual labels:  notifications, toast
Gsmessages
A simple style messages/notifications, in Swift.
Stars: ✭ 595 (+238.07%)
Mutual labels:  notifications, toast
Laravel Notify
Flexible Flash notifications for Laravel
Stars: ✭ 787 (+347.16%)
Mutual labels:  notifications, toast
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (-44.32%)
Mutual labels:  notifications, toast
Svelte Notifications
Svelte toast notifications component that can be used in any JS application
Stars: ✭ 146 (-17.05%)
Mutual labels:  notifications, toast
Jquery Toast Plugin
Highly customizable jquery plugin to show toast messages
Stars: ✭ 1,237 (+602.84%)
Mutual labels:  notifications, toast
Cogo Toast
Beautiful, Zero Configuration, Toast Messages for React. Only ~ 4kb gzip, with styles and icons
Stars: ✭ 557 (+216.48%)
Mutual labels:  notifications, toast
Notistack
Highly customizable notification snackbars (toasts) that can be stacked on top of each other
Stars: ✭ 2,562 (+1355.68%)
Mutual labels:  notifications, toast
Ng Snotify
Angular 2+ Notification Center
Stars: ✭ 304 (+72.73%)
Mutual labels:  notifications, toast
Vue Toastification
Vue notifications made easy!
Stars: ✭ 747 (+324.43%)
Mutual labels:  notifications, toast
Ftindicator
A light wight UI package contains local notification, progress HUD, toast, with blur effect, elegant API and themes support.
Stars: ✭ 292 (+65.91%)
Mutual labels:  notifications, toast
Notie
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies
Stars: ✭ 6,170 (+3405.68%)
Mutual labels:  notifications, toast
ngx-toasta
Simple and clean Toast notification library for AngularX (Angular2 and beyond)
Stars: ✭ 20 (-88.64%)
Mutual labels:  notifications, toast
php-flasher
🔔 Flasher is a powerful and flexible flash notifications system for PHP, Laravel, Symfony
Stars: ✭ 68 (-61.36%)
Mutual labels:  notifications, toast
Reapop
📮 A simple and customizable React notifications system
Stars: ✭ 1,155 (+556.25%)
Mutual labels:  notifications, toast
Notyf
👻 A minimalistic, responsive, vanilla JavaScript library to show toast notifications.
Stars: ✭ 2,093 (+1089.2%)
Mutual labels:  notifications, toast

Toast Notifications for React.js. Build Status

Installation

The recommended way to include this sdk into your project is by using npm. Install it into your project as a dependency with

$ npm install react-notify-toast --save

How to use

To include the modules in the browser context use a bundler tool like Browserify or Webpack.

Import into your project

To include this project you need to require the module by using CommonJS syntax or ES6 Modules Syntax (recommended).

// ES6
import Notifications, {notify} from 'react-notify-toast';
/* Notifications is the default export.
   It represents the React Component that contains the notifications.

   You can give the default export any name
   but in this example it will be referenced as Notifications */

For best results, render the Notifications component in the higher DOM node possible, such as:

// react's app render function
render() {
	return (
		<div className='main'>
			<Notifications />
			...
		</div>
	)
}

Then just call a notification with notify.show()

notify.show('Toasty!');

Options

The toast notification function notify.show() supports message, type and timeout attributes in the following way.

notify.show(message, type, timeout, color)

message is the content of the toast notification.

type consists of three variants:

  • success to render a success notification.
  • warning to render a warning notification.
  • error to render an error notification.
  • custom to render user defined colors for the notification.

if type is not set, it will render a neutral notification.

timeout is the time (in milliseconds) the toast will remain on screen. if it's not set, it will display for the default 5000ms time. You can also pass -1 to cause the notification to display persistently.

color is for the background as well as the text of the notification. It accepts an object with the following properties

let myColor = { background: '#0E1717', text: "#FFFFFF" };
notify.show("this is sample text", "custom", 5000, myColor);

Manual closing

The notification can be programmatically closed using the hide function, for example, in the click handler of a button in the notification:

notify.show(
  <div>
    this wont close until you click
    <button onClick={notify.hide}>close</button>
  </div>, "error", -1
);

Overriding Defaults

The <Notification/> component can receive an options property, which can override any value in src/defaults.js

This is usually useful to modify the zIndex to ensure the toast notifications are displayed on top of other elements with crazy z-index™

If overwritten, these options will be the default for all subsequent notifications

Supported Options:

  • wrapperId HTML id property added to the notification container
  • animationDuration time (in milliseconds) used for the hide and show transitions
  • timeout time (in milliseconds) the toast will remain on screen
  • zIndex sets z-index for notification container
  • top sets vertical offset from top of viewport (in any CSS units)
  • colors object that contains supported styles for notifications (can be replaced to support custom color schemes)

Example:

// Will display the notifications at z-index: 200, and with a vertical offset of 50px
<Notification options={{zIndex: 200, top: '50px'}} />

Note:

Keep in mind that it can only override topmost values, and not nested values. (i.e. not a deep merge, but a shallow assign).

Queued Notifications

A notification queue can be created using the createShowQueue function, for example, in the constructor of a component:

constructor() {
    super();
    this.show = notify.createShowQueue();
}

This queue can then be used with the same API as the notify.show function:

this.show('Toasty!');

The createShowQueue function has two optional arguments:

  • initialRecallDelay is how long (in ms) to wait if the first attempt at showing a notification fails (because a non-queued notification was already being shown). Default: 500ms

  • recallDelayIncrement is a time (in ms) added to the recallDelay after each failed attempt. This is to mitigate numerous rapidly-repeated calls in the case of a non-queued notification being shown without a timeout. Default 500ms

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].