@dafcoe/vue-notification

Notification/Toast Component Using Vue3
5,321 31
Install
npm install @dafcoe/vue-notification
Latest Version:0.1.6
Vue:3
License:MIT
Last Updated:Jul 20, 2022
Links: GitHub  ·  npm
Maintainer: dafcoe

@dafcoe/vue-notification sample

npm bundle size npm GitHub package.json version

@dafcoe/vue-notification

Easy to use, customisable notification/toast library built using Vue3.
See it action on demo page.

Installation

Install the package as a project dependency using yarn or npm:

$ yarn add @dafcoe/vue-notification

--- or ---

$ npm install --save @dafcoe/vue-notification

Usage

Import VueNotificationList component, either globally (on your main.js / main.ts file) or locally (on your component):

// Globally
import VueNotificationList from '@dafcoe/vue-notification'
const app = createApp(App)
app.use(VueNotificationList).mount('#app')

// Locally
import { VueNotificationList } from '@dafcoe/vue-notification'

Import default styles (optional - you can define your own styling):

import '@dafcoe/vue-notification/dist/vue-notification.css'

Use it in the template as follows:

<vue-notification-list></vue-notification-list>

Options

Position

By default, the notification list is displayed on bottom right corner of the screen. You can customize this using "top-left", "top-right", "bottom-left" or "bottom-right" on position prop:

<vue-notification-list position="top-left|top-right|bottom-left|bottom-right"></vue-notification-list>

Pushing Notifications

To push a notification, you have call setNotification from vue-notification.store, passing a notification object:

import { useNotificationStore } from '@dafcoe/vue-notification'
...
const { setNotification } = useNotificationStore()
setNotification(notificationA)
setNotification(notificationB)

A notification object has the following properties:

{
  "message": string,
  "type": string ("info"|"warning"|"alert"|"success"),
  "showIcon": boolean,
  "dismiss": {
    "manually": boolean,
    "automatically": boolean
  },
  "duration": number,
  "showDurationProgress": boolean,
  "appearance": string ("light"|"dark"|"glass")
}

Please check the demo page to easily see all propreties in action.

License

MIT License © Daf Coe

Related Packages

gooey-toast

A framework-agnostic, physics-inspired toast notification library.

5,804 3
vue-toastification

Toasts for Vue made easy!

8,941,430 3,362
@brackets/vue-toastification

Toasts for Vue made easy with custom component!

18,111 1
vue-toast-notification

Vue.js toast notification plugin

2,108,310 648
vue-toast-notification-x

Vue.js toast notification plugin, Degica fork of original by ankurk91

11,697 0

Version History

Version Released Vue License
0.1.6 ^3.0.0 MIT
0.1.5 ^3.0.0 MIT
0.1.4 ^3.0.0 MIT
0.1.3 ^3.0.0 MIT
0.1.2 ^3.0.0 MIT