All Projects → websmurf → Vue2 Notify

websmurf / Vue2 Notify

Licence: mit
Simple Vue2 notification component

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue2 Notify

Vue Codemirror
⌨️ @codemirror component for @vuejs
Stars: ✭ 2,115 (+5775%)
Mutual labels:  vue-component, vuejs2
vue-notification-bell
Vue.js notification bell component.
Stars: ✭ 64 (+77.78%)
Mutual labels:  vuejs2, vue-component
Vue Marquee Text Component
[CSS GPU Animation] Marquee Text for vuejs
Stars: ✭ 226 (+527.78%)
Mutual labels:  vue-component, vuejs2
Vue Toastr
Vuejs Toast : Plugin and Component Capability.
Stars: ✭ 93 (+158.33%)
Mutual labels:  vue-component, vuejs2
Vue Touch Ripple
👆 Touch ripple component for @vuejs
Stars: ✭ 443 (+1130.56%)
Mutual labels:  vue-component, vuejs2
Vue Gmaps
Search places and address using Google Maps API
Stars: ✭ 108 (+200%)
Mutual labels:  vue-component, vuejs2
jooger.me
👍 My personal website,powered by @nuxt
Stars: ✭ 39 (+8.33%)
Mutual labels:  vuejs2, vue-component
Vue Social Sharing
A renderless Vue.js component for sharing links to social networks, compatible with SSR
Stars: ✭ 1,071 (+2875%)
Mutual labels:  vue-component, vuejs2
Vue Video Player
🎞 @videojs component for @vuejs
Stars: ✭ 4,026 (+11083.33%)
Mutual labels:  vue-component, vuejs2
Quasar
Quasar Framework - Build high-performance VueJS user interfaces in record time
Stars: ✭ 20,090 (+55705.56%)
Mutual labels:  vue-component, vuejs2
Xcui
🍴 A Vue.js 2.x desktop components colletion
Stars: ✭ 88 (+144.44%)
Mutual labels:  vue-component, vuejs2
Vue Star Rating
⭐️ A simple, highly customisable star rating component for Vue 2.x. / 3.x
Stars: ✭ 509 (+1313.89%)
Mutual labels:  vue-component, vuejs2
Vue Particles
Vue.js component for particles backgrounds ✨
Stars: ✭ 1,220 (+3288.89%)
Mutual labels:  vue-component, vuejs2
Vue Awesome Swiper
🏆 Swiper component for @vuejs
Stars: ✭ 12,072 (+33433.33%)
Mutual labels:  vue-component, vuejs2
Vue Numeral Filter
Vue.js filter for Numeral.js 🔢 🔣
Stars: ✭ 73 (+102.78%)
Mutual labels:  vue-component, vuejs2
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (+602.78%)
Mutual labels:  vue-component, vuejs2
Navscroll Js
Lightweight package for highlighting menu items as you scroll the page, also scrolling to target section when item clicked. Use as a vue component/directive or in vanilla js.
Stars: ✭ 41 (+13.89%)
Mutual labels:  vue-component, vuejs2
vue-popover
Reusable popover component for Vue
Stars: ✭ 22 (-38.89%)
Mutual labels:  vuejs2, vue-component
Vue2 Calendar
vue 2.x calendar component
Stars: ✭ 477 (+1225%)
Mutual labels:  vue-component, vuejs2
Vue Quill Editor
🍡@quilljs editor component for @vuejs
Stars: ✭ 6,874 (+18994.44%)
Mutual labels:  vue-component, vuejs2

Notify

Build Status Coverage Status

A simple bootstrap|bulma styled Vue component for notifications. Compatible with Vue 2.x

Requirements

Required packages:

  • vue 2+
  • velocity-animate 1.5+

Optional packages:

  • bootstrap or bulma (only used for styling)

Install

$ yarn add vue2-notify

Then in your main.js:

import Notify from 'vue2-notify'

// Use Notify
Vue.use(Notify)

Usage

Inside your component:

this.$notify('A message that should be displayed', 'type')

or

Vue.$notify('A message that should be displayed', 'type')

You may use short type call:

this.$notify.success('This is success message');

or

Vue.$notify('This is success message');

Bulma users can call this.$notify.danger('Error message');, this.$notify.danger() is link to this.$notify.error()

Configuration

Option Type Default Description
itemClass String 'alert col-12' The class that the notification is wrapped in, defaults to the default bootstrap style
duration Integer 500 The amount of milliseconds that the animation should take (slideDown/slideUp, fadeIn/fadeOut)
visibility Integer 2000 The amount of milliseconds that the notification should be visible (if notification is not permanent)
position String 'top-left' The location of the notification, currently possible: top-left, top-right, top-full, bottom-left, bottom-right and bottom-full
enter String 'slideDown' Entry animation type, currently possible: slideDown, fadeIn
leave String 'slideUp' Exit animation type, currently possible: slideUp, fadeOut
permanent Boolean false Disable notification auto close
mode String 'text' Set 'html' to output real html. Only use HTML interpolation on trusted content and never on user-provided content.
closeButtonClass Boolean / String false Class name for close button. If false - close button will not be displayed. ( Example: set 'delete' for bulma or 'close' for bootstrap.)

Configuration options can be provided as options in the Vue.use statement:

// Use Notify
Vue.use(Notify, {visibility: 5000, permanent: true})

Overriding configuration

You can override the itemClass, iconClass, visibility, mode or closeButtonClass options on a per usage basis:

this.$notify('A message that should be displayed', 'type', { itemClass: 'alert col-6 alert-info', iconClass: 'fa fa-lg fa-handshake-o', visibility: 10000 })

Type should be one of the types defined in the configuration of the component.

Types

Defines the type of notifications that can be triggered

Type ItemClass IconClass
info 'alert-info' 'fa fa-lg fa-info-circle'
error 'alert-danger' 'fa fa-lg fa-exclamation-triangle'
warning 'alert-warning' 'fa fa-lg fa-exclamation-circle'
success 'alert-success' 'fa fa-lg fa-check-circle'

You can override the default list of types in the following way, for example to use glyphicons instead of font awesome icons:

const types = {
  info: { itemClass: 'alert-info', iconClass: 'glyphicons glyphicons-info-sign'},
  ..
  success: { itemClass: 'alert-success', iconClass: 'glyphicons glyphicons-ok'},
}

Vue.$notify.setTypes(types)

Examples

Using vue2-notify with Bulma

In app.js:

import Notify from 'vue2-notify'
Vue.use(Notify, {
  itemClass: 'notification'
})
const types = {
  info: { itemClass: 'is-info', },
  error: { itemClass: 'is-danger' },
  warning: { itemClass: 'is-warning' },
  success: { itemClass: 'is-success', iconClass: 'fa fa-lg fa-check-circle' }
}

Vue.$notify.setTypes(types);

And call this.$notify method as usual:

this.$notify('A message that should be displayed', 'info')

or

this.$notify.info('A message that should be displayed')

HTML in notification

this.$notify('<p>My HTML <br/>message</p>', 'info', {mode: 'html'})

or

this.$notify.error('<p>My HTML <br/>message</p>', {mode: 'html'})

Permanent notification

this.$notify('Permanent message', 'info', {permanent: true})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].