All Projects → szboynono → mosha-vue-toastify

szboynono / mosha-vue-toastify

Licence: MIT license
A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.

Programming Languages

typescript
32286 projects
SCSS
7915 projects
Vue
7211 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mosha-vue-toastify

denbun
Adjust showing frequency of Android app messages, and to be more user friendly 🐦
Stars: ✭ 17 (-90.81%)
Mutual labels:  toast, snackbar, notification
React Toastify
React notification made easy 🚀 !
Stars: ✭ 8,113 (+4285.41%)
Mutual labels:  toast, snackbar, notification
Noty
A simple library for creating animated warnings/dialogs/alerts for Android.
Stars: ✭ 136 (-26.49%)
Mutual labels:  toast, snackbar, notification
vue-component-lib-starter
A bare-bones example of creating your own Vue component library.
Stars: ✭ 221 (+19.46%)
Mutual labels:  vue3, vite
vueuse-vite-starter
⚡️ Starter for Vite + VueUse + TypeScript
Stars: ✭ 121 (-34.59%)
Mutual labels:  vue3, vite
artemis
MateCloud前端代码,基于vue3、vite、pinia、ant-design vue实现的中台系统
Stars: ✭ 129 (-30.27%)
Mutual labels:  vue3, vite
Snackbar
A tiny browser library for showing a brief message at the bottom of the screen (1kB gzipped).
Stars: ✭ 224 (+21.08%)
Mutual labels:  toast, snackbar
AckBar
AckBar is a very lightweight and customizable android library to display brief message to user.
Stars: ✭ 14 (-92.43%)
Mutual labels:  toast, snackbar
win7
Yet another OS preview via web technologies focused on Microsoft Windows 7.
Stars: ✭ 93 (-49.73%)
Mutual labels:  vue3, vite
rustplatz
(Inoffizielle) Website für das Rust-Projekt von Dhalucard, Bonjwa und RocketBeans
Stars: ✭ 15 (-91.89%)
Mutual labels:  vue3, vite
iro
IRO - Amazing Color Tools. Color Convert HEX, RGB, HSL and CMYK. Color Inspection with Camera.
Stars: ✭ 103 (-44.32%)
Mutual labels:  vue3, vite
chengpeiquan.com
My personal website. Base on Vite 2.0 and Vue 3.0. If you want to know how to use Vite to develop a project, you can refer to this repository.
Stars: ✭ 43 (-76.76%)
Mutual labels:  vue3, vite
vue-next-admin
🎉🎉🔥基于vue3.x 、Typescript、vite、Element plus等,适配手机、平板、pc 的后台开源免费模板库(vue2.x请切换vue-prev-admin分支)
Stars: ✭ 1,002 (+441.62%)
Mutual labels:  vue3, vite
fastadmin
vue3 + element-plus fast admin scaffold, 基于vue3和ElementPlus的中后台快速应用脚手架
Stars: ✭ 50 (-72.97%)
Mutual labels:  vue3, vite
RuoYi-Cloud-Vue3
🎉 基于Spring Boot、Spring Cloud & Alibaba、Vue3 & Vite、Element Plus的分布式前后端分离微服务架构权限管理系统
Stars: ✭ 295 (+59.46%)
Mutual labels:  vue3, vite
Admin-Frame-Vue3
基于Vue3 + Element-Plus + Vite 开发的中/后台管理系统
Stars: ✭ 181 (-2.16%)
Mutual labels:  vue3, vite
vue-lite-admin
a lite vue3.0 admin template,there is no typescript and vuex (但注释挺全)
Stars: ✭ 67 (-63.78%)
Mutual labels:  vue3, vite
vue-devui-early
Vue3版本的DevUI组件库。本仓库已迁移至:https://github.com/DevCloudFE/vue-devui
Stars: ✭ 39 (-78.92%)
Mutual labels:  vue3, vite
preview-pro
Use pro-layout in vitejs. preview https://sendya.github.io/preview-pro/index.html
Stars: ✭ 71 (-61.62%)
Mutual labels:  vue3, vite
React Native Smart Tip
🔥🔥🔥Toast , SnackBar , Modal , Show Toast above Modal
Stars: ✭ 198 (+7.03%)
Mutual labels:  toast, snackbar

Mosha Vue Toastify

Build Status

A lightweight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.

English | 简体中文

alt text

Talk is cheap, show me the demo

Try it out in the playground in the documentation

Features

  • Super easy to setup! try follow this
  • Swipe to close
  • Support for Composition API
  • Written in typescript, full typescript support
  • Super light weight
  • Define behavior per toast
  • Fun progress bar to display remaining time
  • A lot more coming!

Installation

With NPM:

$ npm install mosha-vue-toastify

With Yarn:

$ yarn add mosha-vue-toastify

The gist

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

Configuration

The createToast function accepts 2 arguments:

  • First argument:

    • It can be just a string or a object like this: { 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
    • It can also accept a Vue 3 component or a VNode if you need more customization, e.g.
      // 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.

    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? Note: passing -1 to the timeout will stop the modal from closing.
    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
  • Programatically closing The createToast function returns an object that contains a close funtion that allows the user to programatically dismiss the toast. See below:

        import { createToast } from 'mosha-vue-toastify';
        import CustomizedContent from "./CustomizedContent.vue";
        import 'mosha-vue-toastify/dist/style.css';
    
        export default defineComponent({
          setup () {
            const toast = () => {
                // This close function can be used to close the toast
                const { close } = createToast(CustomizedContent)
                // close()
            }
    
            return { toast }
          }
        })

    To clear all the toasts, use the clearToasts function. See below

        import { createToast, clearToasts } from 'mosha-vue-toastify';
        import CustomizedContent from "./CustomizedContent.vue";
        import 'mosha-vue-toastify/dist/style.css';
    
        export default defineComponent({
          setup () {
            const clear = () => {
              // clears all the toasts
              clearToasts()
            }
    
            return { clear }
          }
        })

Support

Give this project a if you like it. Any suggestions are welcome!

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