
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
mosha-vue-toastify
Advanced tools
A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.
A lightweight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.
English | 简体中文
Try it out in the playground in the documentation
With NPM:
$ npm install mosha-vue-toastify
With Yarn:
$ yarn add mosha-vue-toastify
<template>
<button @click="toast">Toast it!</button>
</template>
<script lang='ts'>
import { defineComponent } from 'vue'
// import the library
import { createToast } from 'mosha-vue-toastify';
// import the styling for the toast
import 'mosha-vue-toastify/dist/style.css'
export default defineComponent({
name: 'HelloWorld',
setup () {
const toast = () => {
createToast('Wow, easy')
}
return { toast }
}
})
</script>
The createToast
function accepts 2 arguments:
First argument:
{ title: 'some title', description: 'some good description'}
. By the way, description now accepts html, for more customization, we recommand trying out the custom component approach // without props
import { createToast } from 'mosha-vue-toastify';
import CustomizedContent from "./CustomizedContent.vue";
import 'mosha-vue-toastify/dist/style.css';
export default defineComponent({
setup () {
const toast = () => {
createToast(CustomizedContent)
}
return { toast }
}
})
// with props
import { createToast, withProps } from 'mosha-vue-toastify';
import CustomizedContent from "./CustomizedContent.vue";
import 'mosha-vue-toastify/dist/style.css';
export default defineComponent({
setup () {
const toast = () => {
createToast(withProps(CustomizedContent, { yourFavProp: 'bruh' }))
}
return { toast }
}
})
Second argument: the second argument is an options object.
Options:
name | type | default | description |
---|---|---|---|
type | 'info', 'danger', 'warning', 'success', 'default' | 'default' | Give the toast different styles and icons. |
timeout | number | 5000 | How many ms you want the toggle to close itself? |
position | 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'top-center', 'bottom-center' | 'top-right' | Where do you want the toast to appear? |
showCloseButton | boolean | true | Do you wanna show the close button ? |
showIcon | boolean | false | Do you wanna show the icon ? |
transition | 'bounce', 'zoom', 'slide' | 'bounce' | Which animation do you want? |
hideProgressBar | boolean | false | Do we wanna hide the fancy progress bar? |
swipeClose | boolean | true | Allows the user swipe close the toast |
toastBackgroundColor | string | default color | Customize the background color of the toast. |
onClose | function | N/A | This function will be called at the end of the toast's lifecycle |
Give this project a ⭐ if you like it. Any suggestions are welcome!
FAQs
A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.
The npm package mosha-vue-toastify receives a total of 2,983 weekly downloads. As such, mosha-vue-toastify popularity was classified as popular.
We found that mosha-vue-toastify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.