1.1.4 • Published 4 years ago

@kugatsu/vuenotification v1.1.4

Weekly downloads
117
License
MIT
Repository
github
Last release
4 years ago

Notification Vue JS 🚀

The Notification vue plugin allows you to display notifications from anywhere within your app. Just with one line of code. This notification plugin is unique from others as it utilises the GSAP library allowing you to animate your notifications in a near limitless number of ways

img vue notification img vue notification

How to use it

Install with npm. If you don't already have GSAP in your project, you also have to install it.

npm i @kugatsu/vuenotification --save
npm i gsap --save

Import with ES6

import VueNotification from "@kugatsu/vuenotification";

Vue.use(VueNotification, {
  timer: 20
});

Emit the notification where you want.

this.$notification.new("hello world", {  timer: 10 });
this.$notification.error("hello world", { infiniteTimer: false });
...

Parameters

NameTypeDefault value
messageString"🚧 You missed something ..."
titleStringnull
timerNumber5(s)
infiniteTimerBooleanfalse
positionStringtopRight
typeStringprimary
typeObject( See type section )
showLeftIcnBooleantrue
showCloseIcnBooleanfalse
animateInFunction()=> TimelineMax
animateOutFunction()=> TimelineMax

position

NameValue
top centertopCenter
top lefttopLeft
top righttopRight
bottom centerbottomCenter
bottom leftbottomLeft
bottom rightbottomRight

Type

There are 5 notifications types.

  • primary
  • dark
  • success
  • warning
  • error

To customise the colors of the notification you can do this globally or locally :

// Sample to change all error notifications
Vue.use(NotificationVuejs, {
  error: {
    background: "green",
    color: "red"
  }
});

Animation

To animate the in and out animation, we use GSAP. To customize the default animation, you have to add to your config object. animateIn and animateOut with a function that returns a gsap timeline.

Vue.use(NotificationVuejs, {
  animateIn: function() {
    var tl = new TimelineMax()
      .from(this.notificationEl, 0.6, {
        opacity: 0
      })
      .from(this.notificationEl, 0.4, {
        borderRadius: 100,
        width: 58,
        height: 58
      })
      .from(this.notificationElContent, 0.3, {
        opacity: 0
      });
    return tl;
  }
});

You can select the notification with a custom selector.

SelectorValue to use
all notificationthis.notification
current notificationthis.notificationEl
all content of the notificationthis.notificationElContent
Notification titlethis.notificationTitle
Notification messagethis.notificationMessage
Notification iconethis.notificationIcone
Notification close buttonthis.notificationIconeClose

Credit

Icones

1.1.4

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago