React Notifications
Installation
npm install --save react-notifications
Usage
Note
Use only one 'NotificationContainer' component in the app.
CSS
Webpack:
;
Other
JS
;; Component { return { }; }; { return <div> <button className='btn btn-info' onClick=this>Info </button> <hr/> <button className='btn btn-success' onClick=this>Success </button> <hr/> <button className='btn btn-warning' onClick=this>Warning </button> <hr/> <button className='btn btn-danger' onClick=this>Error </button> <NotificationContainer/> </div> ; } ;
NotificationContainer Props
Name | Type | Default | Required |
---|---|---|---|
enterTimeout | number | 400 | false |
leaveTimeout | number | 400 | false |
NotificationManager API
- NotificationManager.info(message, title, timeOut, callback, priority);
- NotificationManager.success(message, title, timeOut, callback, priority);
- NotificationManager.warning(message, title, timeOut, callback, priority);
- NotificationManager.error(message, title, timeOut, callback, priority);
Name | Type | Description |
---|---|---|
message | string | The message string |
title | string | The title string |
timeOut | integer | The popup timeout in milliseconds |
callback | function | A function that gets fired when the popup is clicked |
priority | boolean | If true, the message gets inserted at the top |
Example
View demo or example folder.