Gathering detailed insights and metrics for @conciergerie.dev/vue-toaster
Gathering detailed insights and metrics for @conciergerie.dev/vue-toaster
Gathering detailed insights and metrics for @conciergerie.dev/vue-toaster
Gathering detailed insights and metrics for @conciergerie.dev/vue-toaster
npm install @conciergerie.dev/vue-toaster
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Vue.js toast notification plugin for vue 3
1# yarn 2yarn add @conciergerie.dev/vue-toaster 3 4# npm 5npm install --save-dev @conciergerie.dev/vue-toaster
You can install Toaster so it's usable globally:
1// In you main.js 2import Toaster from "@conciergerie.dev/vue-toaster"; 3 4createApp(App).use(Toaster).mount("#app");
You can also import Toaster locally:
1import { createToaster } from "@conciergerie.dev/vue-toaster"; 2 3const toaster = createToaster({ /* options */ }); 4 5toaster.show(`Hey! I'm here`);
1// this.$toast.show(message, {/* options */}); 2this.$toast.show(`Hey! I'm here`); 3this.$toast.success(`Hey! I'm here`); 4this.$toast.error(`Hey! I'm here`); 5this.$toast.warning(`Hey! I'm here`); 6this.$toast.info(`Hey! I'm here`); 7 8// Close all opened toast after 3000ms 9setTimeout(this.$toast.clear, 3000);
The API methods accepts these options:
Attribute | Type | Default | Description |
---|---|---|---|
message | String | -- | Message text/html (required) |
type | String | default | One of success , info , warning , error , default |
position | String | bottom-right | One of top , bottom , top-right , bottom-right ,top-left , bottom-left |
duration | Number or false | 4000 | Visibility duration in milliseconds or false that disables duration |
dismissible | Boolean | true | Allow user close by clicking |
onClick | Function | -- | Do something when user clicks |
onClose | Function | -- | Do something after toast gets dismissed |
queue | Boolean | false | Wait for existing to close before showing new |
maxToasts | Number or false | false | Defines the max of toasts showed in simultaneous |
pauseOnHover | Boolean | true | Pause the timer when mouse on over a toast |
useDefaultCss | Boolean | true | User default css styles |
show(message, ?options)
This is generic method, you can use this method to make any kind of toast.
1// Can accept a message as string and apply rest of options from defaults 2this.$toast.show("Howdy!"); 3 4// Can accept an Object of options. 5// If yout don't pass options, the default toast will be showed 6this.$toast.show("Something went wrong!", { 7 type: "error", 8 // all of other options may go here 9});
success(message,?options)
There are some proxy methods to make it more readable. The same rule for error
, info
and warning
methods
1this.$toast.success("Profile saved.", { 2 // optional options Object 3});
You can set options for all the instances during plugin initialization
1app.use(Toaster, { 2 // One of the options 3 position: "top", 4});
Further you can override option when creating new instances
1this.$toast.success("Order placed.", { 2 // override the global option 3 position: "bottom", 4});
Clone the project and run:
cd vue-toaster-example
npm install
npm run dev
MIT License
No vulnerabilities found.
No security vulnerabilities found.