Skip to content

Toast

A simple set of toast notifications

Demo




Install

bash
npm i @vuesimple/vs-toast

Usage

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

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

CDN

html
<script src="https://cdn.jsdelivr.net/npm/@vuesimple/vs-toast@3.1.6/dist/index.min.js"></script>
html
<script>
  export default {
    methods: {
      showToast() {
        VsToast.show({
          title: 'Success Title',
          message: 'Success message',
          variant: 'success',
        });
      },
    },
  };
</script>

Props

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:

javascript
VsToast.success('Success Message');

// Or

VsToast.error('Error Message');

// Or

VsToast.warning('Warning Message');