Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@vuesimple/vs-toast

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vuesimple/vs-toast

A simple vue toast.

latest
Source
npmnpm
Version
3.0.9
Version published
Maintainers
0
Created
Source

Vue Simple Toast

🗃 A simple vue toast. Perfect for all your toast/notification scenarios.

A light weight vue plugin built groundup.

npm npm

forthebadge forthebadge forthebadge forthebadge forthebadge forthebadge


📺 Live Demo

Code Sandbox: Link


🛠 Install

npm i @vuesimple/vs-toast

🚀 Usage

<script>
  import VsToast from '@vuesimple/vs-toast';

  export default {
    methods: {
      showToast() {
        VsToast.show({
          title: 'Success Title',
          message: 'Success message',
          variant: 'success',
        });
      },
    },
  };
</script>

🌎 CDN

<script src="https://unpkg.com/@vuesimple/vs-toast@<version>/dist/vs-toast.min.js"></script>
<script>
  export default {
    methods: {
      showToast() {
        VsToast.show({
          title: 'Success Title',
          message: 'Success message',
          variant: 'success',
        });
      },
    },
  };
</script>

Nuxt.js

Nuxt Code Snippet

After installation,

  • Create a file /plugins/vs-toast.js

    import Vue from 'vue';
    import VsToast from '@vuesimple/vs-toast';
    
    Vue.component('vs-toast', VsToast);
    
  • Update nuxt.config.js

    module.exports = {
      ...
      plugins: [
        { src: '~plugins/vs-toast', mode: 'client' }
        ...
      ]
    }
    
  • In the page/ component

<script>
  export default {
    methods: {
      showToast() {
        VsToast.show({
          title: 'Success Title',
          message: 'Success message',
          variant: 'success',
        });
      },
    },
  };
</script>

Note

  • For older Nuxt versions, use <no-ssr>...</no-ssr> tag.
  • You can also do import VsToast from '@vuesimple/vs-toast' & add in component:{VsToast} and use it within component, without globally installing in plugin folder.

⚙ Options

NameTypeDefaultDescription
variantString-Available variants; success, warning, error, info, secondary
titleString-Toast title
messageString-Toast body/content/description
positionStringtop-centerAvailable positions: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right
timeoutNumber5000Hide timeout
showCloseBooleanfalseShow/Hide close button
typeStringtoastAvailable types: toast, alert
animationStringslideDefault class applied for animation: vs-toast--transition-{animation-name}
isStickyBooleanfalseWhether toast should close automatically or not

🌟 Tips

You can also directly call success, warning & error functions as below:

VsToast.success('Success Message');

// Or

VsToast.error('Error Message');

// Or

VsToast.warning('Warning Message');

Keywords

vue

FAQs

Package last updated on 08 Jan 2025

Did you know?

Socket

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.

Install

Related posts