Notifier to display different types of stacked messages at the side of screen
• Library agnostic • Vue.js connector - you can use it anywhere in components and in vue-router and vuex • Compact • Smooth css animation without jumps on manual close
position: duration:
npm install --save mk-toast
var mktoast = require('mk-toast');
<link href="nodes_modules/mk-toast/dist/mk-toast.min.css" rel="stylesheet"> <script src="nodes_modules/mk-toast/dist/mk-toast.min.js">
import mktoastVue from 'mk-toast/vue'; // if you want non-default theme insert it here: // import "mk-toast/dist/mk-toast-alt.css"; Vue.use(mktoastVue);Inside vue components use this.$mktoast instead of mktoast:
this.$mktoast.echo('your message');
To use it in a router or vuex, which does not have vue context, use es6 approach:
import mktoast from 'mk-toast';
mktoast.echo('your message');
You only need to include default styles from mk-toast/dist/mk-toast.css
Styles are follows BEM methodology and named in a way .mktoast-message__{element}, .mktoast-message_{modifier}. Just put your styles after default styles mk-toast/dist/mk-toast.css As an example you can take mk-toast/dist/mk-toast-alt.css.
/* basic styles for all messages */
.mktoast-message {
background-color: #e3dfec;
border: 4px double #b9b0cf;
color: #000000;
border-radius: 5px;
}
.mktoast-message .mktoast-message__title {
background-color: #39304f;
color: #ffffff;
}
/* danger message */
.mktoast-message_danger {
background-color: #F48FB1;
border-color: #F06292;
color: #000;
}
.mktoast-message_danger .mktoast-message__title {
background-color: #F06292;
}
| option | type | default | comment |
|---|---|---|---|
| position | string | 'right bottom' | Positioning of mktoast: left|center|right top|bottom |
| duration | milliseconds | 5000 | Time to keep toast message on screen |
| container | DOMElement | 'empty' | Parent DOMElement of toast messages, default is body |
| type | string | 'default' | Used only in mktoast.print(). Type of message: default|info|danger|success|warning. |
| message | string | 'empty' | Used only in mktoast.print(). String or html code of message. |
| title | string | undefined | Used only in mktoast.print(). String of toast title. |