All Projects β†’ marverix β†’ v-tostini

marverix / v-tostini

Licence: Apache-2.0 License
Toast plugin for Vue.js 2.x

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to v-tostini

Vue Quill Editor
🍑@quilljs editor component for @vuejs
Stars: ✭ 6,874 (+57183.33%)
Mutual labels:  vue-components, vue-plugin, vue-component
Vue Toastr
Vuejs Toast : Plugin and Component Capability.
Stars: ✭ 93 (+675%)
Mutual labels:  toast, vue-plugin, vue-component
Vue Codemirror
⌨️ @codemirror component for @vuejs
Stars: ✭ 2,115 (+17525%)
Mutual labels:  vue-components, vue-plugin, vue-component
Vue Touch Ripple
πŸ‘† Touch ripple component for @vuejs
Stars: ✭ 443 (+3591.67%)
Mutual labels:  vue-components, vue-plugin, vue-component
Vue Qrcode Reader
A set of Vue.js components for detecting and decoding QR codes.
Stars: ✭ 1,240 (+10233.33%)
Mutual labels:  vue-components, vue-plugin, vue-component
Vue Awesome Swiper
πŸ† Swiper component for @vuejs
Stars: ✭ 12,072 (+100500%)
Mutual labels:  vue-components, vue-plugin, vue-component
vue-drag-zone
Drag Zone component for @vuejs
Stars: ✭ 127 (+958.33%)
Mutual labels:  vue-components, vue-plugin, vue-component
toaststrap
A simple, lightweight JavaScript library for showing Bootstrap 5 toast popups.
Stars: ✭ 16 (+33.33%)
Mutual labels:  toast, toast-notifications
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (+50%)
Mutual labels:  vue-components, vue-component
unique-ui
δΈ€δΈͺη”¨δΊŽVue2.xηš„η§»εŠ¨η«―η»„δ»ΆεΊ“
Stars: ✭ 43 (+258.33%)
Mutual labels:  vue-components, vue-component
bs5-utils
A JavaScript utility package for Bootstrap 5 components.
Stars: ✭ 26 (+116.67%)
Mutual labels:  toast, toast-notifications
vue-swimlane
A Text Swimlane plugin for Vue.js
Stars: ✭ 71 (+491.67%)
Mutual labels:  vue-components, vue-plugin
simple-notify
Pure javascript toast notifications.
Stars: ✭ 108 (+800%)
Mutual labels:  toast, toast-notifications
vue-img-orientation-changer
A vue plugin that can help you display image in correct orientation.
Stars: ✭ 38 (+216.67%)
Mutual labels:  vue-plugin, vue-component
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (+2008.33%)
Mutual labels:  vue-components, vue-component
vstx-data-table
A data table component for the Vue Stacks Ecosystem
Stars: ✭ 34 (+183.33%)
Mutual labels:  vue-components, vue-component
Vue Lazy Render
A vue component for lazy rending vue component
Stars: ✭ 219 (+1725%)
Mutual labels:  vue-components, vue-plugin
shadow
Shadow dom support for Vue
Stars: ✭ 46 (+283.33%)
Mutual labels:  vue-components, vue-component
v-owl-carousel
πŸ¦‰ VueJS wrapper for Owl Carousel
Stars: ✭ 46 (+283.33%)
Mutual labels:  vue-components, vue-component
RTL-Toast
Android Toast For RTL Applications
Stars: ✭ 16 (+33.33%)
Mutual labels:  toast, toast-notifications

v-Tostini

npm Lint License

v-Tostini is really plain toast notifications mechanism for Vue.js 2.x. There is no CSS included, which means that you need to add your own flavor for it. Just like with tostini - no one will tell you how it should look like ;)

Demo

https://codesandbox.io/embed/vtostini-demo-btc4g

Getting Started

Prerequisites

This package is using UMD pattern.

Usage

  1. Install it (or download):

    npm i v-tostini
  2. Require in your project:

    const vTostini = require('v-tostini');
  3. Tell Vue to use it:

    Vue.use(vTostini);
  4. Now simply place tostini-plate in your HTML:

    <tostini-plate />
  5. Call from any Vue instance:

    this.$tostini({
      message: 'Delicious!',
      type: 'success'
    });

Usage with Nuxt.js

You can easely use tostini inside Nuxt.js by creating a plugin:

import Vue from 'vue'
import tostini from 'v-tostini'

Vue.use(tostini)

// If you want to use tostini inside your store modules
// the same way you use it in components
// you will need to inject it
export default (ctx, inject) => {
  inject('tostini', Vue.prototype.$tostini)
}

tostini supports >2%, IE11, Safari 10 but if your Nuxt project has different browser targets - you can easely compile it yourself from the available source. To do that you need to add transpile section to you nuxt.config.js build settings:

build: {
    transpile: ['v-tostini']
}

don't forget to target src folder inside the plugin

import Vue from 'vue'
import tostini from 'v-tostini/src'

Features

Use String as an argument

You can also use as argument a string:

this.$tostini('Yupi!');

Above will be the same as:

this.$tostini({
  message: 'Yupi!'
});

Notification Duration

By default duration is calculated by the length of given message. The formula I have created is based on an experiment carried out on colleagues from work. I checked what is the average time that an adult needs to notice and read the technical text that one saw for the first time. Since I have implemented it, complaining that someone did not manage to read the text - ended :)

Of course you can set your own duration:

this.$tostini({
  message: 'This message will be visible for 2s.',
  duration: 2000
});

Types

type field in toastini config is set as data-type in added tostini to tostini-plate. So basicly it's up to you how you will use it.

HTML Support

You can display HTML-based message. Just set html: true flag:

this.$tostini({
  message: 'Wow! Great <b>success</b>!',
  html: true
});

Caution! Sanitization needs to be done on your side!

Custom Template

It's possible to create custom template for your messages:

<tostini-plate class="tostini-plate" v-slot="{ type, message }">
  <div class="tostini" :data-type="type">
    {{ message }}
  </div>
</tostini-plate>

Transitions

You can specify transition name with:

<tostini-plate transition-name="fade" />

Close Button in the Message

<tostini-plate class="tostini-plate" v-slot="{ type, message, close }">
  <div class="tostini" :data-type="type">
    {{ message }}
    <button @click="close">OK</button>
  </div>
</tostini-plate>

Exmaple CSS

So this is CSS that I'm using. As you can see I'm using types:

  • default
  • success
  • error
  • warning
  • info
.tostini-plate {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto !important;
}
.tostini-plate .tostini {
  padding: 0.75rem;
  width: calc(100vw - 3.5rem);
  margin: 0.5rem auto;
  max-width: 40rem;
  color: white;
}
.tostini-plate .tostini[data-type="default"] {
  background: rgba(0, 0, 0, 0.5);
}
.tostini-plate .tostini[data-type="success"] {
  background: rgba(45, 148, 27, 0.95);
}
.tostini-plate .tostini[data-type="error"] {
  background: rgba(148, 27, 27, 0.95);
}
.tostini-plate .tostini[data-type="warning"] {
  background: rgba(216, 143, 9, 0.95);
}
.tostini-plate .tostini[data-type="info"] {
  background: rgba(0, 147, 204, 0.95);
}

Contributors

License

This project is licensed under the Apache-2.0 - see the LICENSE file for details

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].