Skip to main content

Installation

The InertiaToast plugin must be installed in your Vue application to enable toast notifications. It automatically listens for Inertia flash messages and displays them as toasts.

Configuration options

All configuration options are optional. The plugin will use default values if not specified.
number
default:"5000"
Duration in milliseconds before a toast automatically closes. Set to 0 to disable auto-close.
string
default:"top-right"
Position where toasts appear on the screen.Valid values:
  • top-left
  • top-center
  • top-right
  • bottom-left
  • bottom-center
  • bottom-right
number
default:"5"
Maximum number of toasts visible at once. Older toasts are removed when this limit is exceeded.
string
default:"toasts"
The flash message key to look for in Inertia responses. Must match the key used in your Laravel backend.

TypeScript types

How it works

The plugin automatically:
  1. Configures the global toast settings based on provided options
  2. Listens for Inertia’s flash event on the router
  3. Extracts toast messages from flash data using the configured propKey
  4. Adds each toast message to the internal store for display
The plugin only runs in browser environments. It safely returns early during server-side rendering.

Example with custom configuration