react-notification
A complete and totally customizable component for notifications in React
Advanced notification system specification
- You can request a notification to be displayed.
- You can request a notification to hide.
- A notification should not be displayed more than 5 seconds.
- Multiple notifications can be displayed at the same time.
- No more than 3 notifications can be displayed at the same time.
- If a notification is requested while there are already 3 displayed notifications, then queue/postpone it.
Installing
npm install react-notification-popup
Contributing
- Fork project
- Checkout master branch
- Create Feature branch off of the master branch
- Create awesome feature/enhancement/bug-fix
- Optionally create Issue to discuss feature
- Submit pull request from your Feature branch to react-notification's master branch
Using
;;; notificationconfig = maxNotifications: 3 notificationDisplayTime: 5000; const App = <div> <NotificationContainer /> <button onClick= { notification; } > show </button> <button onClick= { notification; } > dismissAll </button> </div>; ;
Methods
config: maxNotifications notificationDisplayTime ;
Configure notification. This is optional. The default maxNotifications is 3 and notificationDisplayTime is 5s.
emit: providerURL title description closeButtonText = "Close" hasCloseButton = true autoClose = true onClick = noop onClose = noop
Emit notification with some informations and callback handler.
dismissAll: onDismiss = noop;
Removes ALL notifications programatically.
Author
License
react-notification-popup is released under the MIT license.
See LICENSE for details.