Toast facade or the toast() helper function.
Using the facade
TheToast facade provides static methods for each toast type:
Method signatures
Each toast method accepts the following parameters:Using the helper
Thetoast() helper provides two usage patterns:
Fluent builder pattern
When called with a message, it returns aPendingToast instance that allows you to chain configuration methods:
Direct toaster access
When called without arguments, it returns theToaster instance for direct method calls:
Toast types
Laravel Inertia Toast supports four toast types:- Success
- Error
- Info
- Warning
Use for successful operations:
Adding a title
You can add an optional title to provide context for your toast messages.With the facade
Use named arguments to specify the title:With the helper
Chain thetitle() method:
Custom duration
By default, toasts auto-dismiss after the duration specified in your config (5000ms). You can override this per toast.Duration is specified in milliseconds. For example,
3000 = 3 seconds.With the facade
With the helper
Chain theduration() method:
Combining title and duration
You can combine both title and duration options:With the facade
With the helper
Multiple toasts
You can queue multiple toasts in a single request. They will be displayed according to yourmax_visible configuration:
Working with redirects
Toasts work seamlessly with redirects because they’re flashed to the session via Inertia:Common patterns
Here are some common usage patterns:API reference
PendingToast methods
ThePendingToast class (returned by toast('message')) provides these chainable methods:
title(string $title): static- Set the toast titleduration(int $milliseconds): static- Set custom duration in millisecondssuccess(): Toaster- Commit as a success toasterror(): Toaster- Commit as an error toastinfo(): Toaster- Commit as an info toastwarning(): Toaster- Commit as a warning toast
Toaster methods
TheToaster class (accessed via Toast facade or toast() without arguments) provides:
success(string $message, ?string $title = null, ?int $duration = null): Toastererror(string $message, ?string $title = null, ?int $duration = null): Toasterinfo(string $message, ?string $title = null, ?int $duration = null): Toasterwarning(string $message, ?string $title = null, ?int $duration = null): Toasteradd(string $message, ToastLevel $level, ?string $title = null, ?int $duration = null): ToasterhasPending(): bool- Check if there are pending toastsgetPropKey(): string- Get the Inertia flash key