Skip to content

useToast ​

Vue composable to display toast notifications (info, success, warning, error, with actions and buttons) from your components, through the toast plugin

WARNING

You must install toast plugin before use it

TIP

More info about toast plugin in its documentation

Usage ​

vue
<script lang="ts" setup>
import { useToast } from 'maz-ui/composables'

const toast = useToast()

toast.info('info message', {
  button: {
    onClick: () => toast.success('clicked'),
    text: 'Click me',
    closeToast: true
  }
})
toast.success('success message', {
  button: {
    href: '/composables/use-toast',
    text: 'Follow me',
    closeToast: true,
  }
})
toast.warning('warning message')
toast.error('error message')
</script>