Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

dacoto/notify.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icon

Notify.js
Total Downloads Latest Stable Version License Last commit

A library to show nice notifications in web application.

VIEW DEMO

Installation

// npm install
npm install @dacoto/notify.js

// yarn install
npm add @dacoto/notify.js

Usage

Include
    import Notify from '@dacoto/notify.js';
CDN
    <script src="//cdn.jsdelivr.net/npm/@dacoto/notify.js/dist/notify.min.js"></script>

Notification example

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();

Notification Params

Options

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

Link

Props Note Type Required
linkHref Link url url X
linkClass Link class string X
linkText Link text string X

Type

Prop Color Icon
primary #4d9aff primary
success #59d9a4 primary
warning #ffc400 primary
danger #ff542e primary

Notification methods

Name Note
open() Opens the notification
close() Closes the notification

License

MIT