GithubHelp home page GithubHelp logo

arkbauer / mosha-vue-toastify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from szboynono/mosha-vue-toastify

0.0 0.0 0.0 3.17 MB

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

License: MIT License

HTML 0.78% TypeScript 37.77% Vue 14.77% SCSS 43.42% Shell 1.23% JavaScript 2.03%

mosha-vue-toastify's Introduction

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'}
    • It can also accept a Vue 3 component if you need more customization, e.g.
      import CustomizedContent from "./CustomizedContent.vue";
    
      export default defineComponent({
        setup () {
          const toast = () => {
              createToast(CustomizedContent)
          }
          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

Support

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

mosha-vue-toastify's People

Contributors

szboynono avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.