Backend configuration
Publish the configuration file to customize backend defaults:config/inertia-toast.php file in your Laravel application.
Configuration options
duration
Type:
Default:
intDefault:
5000position
Type:
Default:
stringDefault:
'top-right'top-righttop-lefttop-centerbottom-rightbottom-leftbottom-center
The position can also be configured on the frontend when registering the plugin or provider.
max_visible
Type:
Default:
intDefault:
5prop_key
Type:
Default:
stringDefault:
'toasts'Inertia::flash(). This is the property name that will be available in your Inertia page props.
Frontend configuration
You can configure frontend toast behavior when registering the Vue plugin or React provider.Vue 3
Pass options when installing the plugin:Options
All options are optional and will use defaults if not provided:React
Pass configuration to the<ToastProvider> component:
Config prop
Theconfig prop accepts a partial configuration object:
Configuration precedence
Configuration values follow this precedence order (highest to lowest):- Per-toast options - Options passed when creating a specific toast
- Frontend configuration - Options passed to plugin/provider
- Backend configuration - Values in
config/inertia-toast.php - Package defaults - Built-in default values
Example
Position examples
Here’s how different position values affect toast placement:- Top positions
- Bottom positions
Duration guidelines
Recommended duration values based on message length:- Short messages (1-20 chars): 3000-4000ms
- Medium messages (21-50 chars): 5000-6000ms (default)
- Long messages (51+ chars): 8000-10000ms
- Critical warnings: 10000-15000ms
Max visible recommendations
The optimal number of simultaneous toasts depends on your use case:- Most applications: 3-5 toasts (default: 5)
- Bulk operations: 8-10 toasts
- Minimal UI: 1-2 toasts
Custom prop key
If you need to use a different Inertia flash key (for example, to avoid conflicts with existing code):Backend
Vue
React
Environment-specific configuration
You can use environment variables to adjust toast behavior across different environments:.env file: