A library to show nice notifications in web application.
VIEW DEMO
// npm install
npm install @dacoto/notify.js
// yarn install
npm add @dacoto/notify.js
import Notify from '@dacoto/notify.js';
<script src="//cdn.jsdelivr.net/npm/@dacoto/notify.js/dist/notify.min.js"></script>
let options = {
title: 'Notification title',
message: 'Notification message',
icon: 'fas fa-home',
};
let type = 'primary';
var notification = new Notify(options, type);
notification.open();
notification.close();
Props |
Default value |
Description |
Type |
Required |
title |
|
Notification title |
string |
X |
message |
|
Notification message |
string |
X |
icon |
notify-icon notify-icon-primary |
Class of notification icon, similar to this:<i class="notify-icon notify-icon-primary"></i> |
string |
|
link |
|
Link at the end of the notification (see link table) |
array |
|
width |
420 |
Width in pixels of the notification |
integer |
|
duration |
0 |
The amount of time in milliseconds before closing the notification. 0 means never closed |
integer |
|
autoOpen |
true |
Open the notification when instantiate it |
boolean |
|
onOpen |
|
Callback for the open event |
function |
|
onClose |
|
Callback for the hide event |
function |
|
Props |
Note |
Type |
Required |
linkHref |
Link url |
url |
X |
linkClass |
Link class |
string |
X |
linkText |
Link text |
string |
X |
Prop |
Color |
Icon |
primary |
#4d9aff |
|
success |
#59d9a4 |
|
warning |
#ffc400 |
|
danger |
#ff542e |
|
Name |
Note |
open() |
Opens the notification |
close() |
Closes the notification |
MIT