Giter Site home page Giter Site logo

flashtoast's Introduction

flashtoast

FlashToast is simple flash messages plugin for vue3 using same style like toast

Install

  npm install --save @alamtheinnov/flashtoast

Configuration

import { flashToast } from '@alamtheinnov/flashtoast';
const app = createApp(App);
app.use(flashToast)
    ...
    .mount('#app');

Declare

In root vue file.

<FlashToast /> 

// OR with all available options

<FlashToast :position="'top-right'" :direction="'rtl'" v-zIndex:3000 v-class:any-class />

CSS inside your app.scss or any.

@import '@alamtheinnov/flashtoast/dist/flashtoast.css';

Usage

Use inject to make available in your component.

import { inject } from 'vue'
export default {
    name: 'ComponentName',
    setup() {
        const toast = inject('toast');

        // Examples
        function showSuccessMessage() {
            toast.success({
                title: 'Success!',
                message: 'Hello world!',
                delay: 50000
            });
        }

        function showInfoMessage() {
            toast.info({
                title: 'Info!',
                message: 'You can\'t perform this action',
                delay: 50000
            });
        }

        function showWarningMessage() {
            toast.warning({
                title: 'Warning!',
                message: 'You can\'t perform this action',
                delay: 50000
            });
        }

        function showErrorMessage() {
            toast.error({
                title: 'Error!',
                message: 'You can\'t perform this action',
                delay: 50000
            });
        }

        return {
            showSuccessMessage,
            showInfoMessage,
            showWarningMessage,
            showErrorMessage
        }
    }
}

Example

Example

Directive

Name Type Default Desciption
class String Can be use for changing the style.
zIndex String 3000 You can give z-index of your choice according to your Application.

Props

Name Type Default Desciption
position String 'top-right' To change the position of like, top-right, bottom-right, bottom-left, top-left & center`
direction String 'ltr' Change direction according to the language of application, possible options ltr & rtl

License

Flashtoast is open-sourced software licensed under the MIT license.

flashtoast's People

Contributors

alamtheinnov avatar

Stargazers

Tariq Ullah avatar  avatar

Watchers

 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.