ToastLevel
TypeScript type representing the severity level of a toast notification.ToastLevel enum values. See the Enums page for more details.
ToastMessage
Represents a single toast notification message with its properties.Properties
The main content of the toast notification.
The severity level of the toast. Must be one of:
'success', 'error', 'info', or 'warning'.Optional title displayed above the message. Pass
null if no title is needed.Custom duration in milliseconds for this specific toast. If
null, uses the default duration from ToastConfig.Source
Usage example
ToastItem
ExtendsToastMessage with a unique identifier. Used internally by the Toaster component to track individual toasts.
Properties
Inherits all properties fromToastMessage:
Unique identifier for the toast. Generated automatically by the Toaster component.
The main content of the toast notification (inherited from
ToastMessage).The severity level of the toast (inherited from
ToastMessage).Optional title displayed above the message (inherited from
ToastMessage).Custom duration in milliseconds (inherited from
ToastMessage).Source
Usage example
You typically don’t need to create
ToastItem objects manually. The Toaster component automatically generates IDs for incoming ToastMessage objects.ToastConfig
Configuration object for the Toaster component. Defines global settings for toast behavior and appearance.Properties
Default duration in milliseconds for all toasts. Can be overridden per toast using
ToastMessage.duration.Default: 3000Screen position where toasts appear. Must be one of:
'top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left', or 'bottom-center'.Default: 'top-right'Maximum number of toasts that can be visible simultaneously. Older toasts are dismissed when the limit is reached.Default:
3The Inertia prop key used to receive toast messages from the backend.Default:
'toasts'Source
Usage examples
The configuration values are set in
config/inertia-toast.php and automatically passed to the frontend. You can override them by passing props to the Toaster component.Type locations
Both Vue and React packages share identical TypeScript interfaces:- Vue:
@inertiatoast/vue/src/types.ts - React:
@inertiatoast/react/src/types.ts