Giter VIP home page Giter VIP logo

vue-notification's Introduction

@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

vue-notification's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vue-notification's Issues

Top/bottom positions

Firstly, thanks for a great plugin. Really appreciate your work.

Secondly, I think it would be useful to have positions of top-centre and bottom-centre.

z-index too small

Hi @dafcoe I am using this amazing notification library you created alongside some other vue component library . When i push notifications, it doesn't show on the screen , and I found from the rendered elements that it was hidden simply by the value of its z-index (z-40). Can this be modified , or can a class property be exposed on the component so that one can modify this value

Progress bar positions

Great component! Can you make an option to allow having the progress bar on the bottom of the alert, instead on left?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.