---
title: "useToast"
description: "Vue composable to display toast notifications (info, success, warning, error, with actions and buttons) from your components, through the toast plugin"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-toast"
---

# useToast

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

- Package: `maz-ui`
- Import: `import { useToast } from 'maz-ui/composables/useToast'`
- Nuxt: auto-imported by `@maz-ui/nuxt` when `mazUi.plugins.toast` is enabled
- Web: https://maz-ui.com/composables/use-toast

**Warning:**

You must install [toast plugin](../plugins/toast.md#install) before use it

**Tip:**

More info about [toast plugin](../plugins/toast.md) 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>
```
