--- layout: home title: "Laravel Inertia Toast: Alerts and Modals for Vue 3 and React" titleTemplate: false description: "Laravel Inertia Toast documentation for notifications, confirmation dialogs, Laravel integration, Vue 3, React, and the complete API." hero: name: "Laravel Inertia Toast" text: "Notifications and confirmation dialogs for Laravel + Inertia + Vue 3 + React" tagline: "Dynamic toast messages and confirm dialogs for your Laravel Inertia app." actions: - theme: brand text: Get Started link: /demo.html - theme: alt text: React Usage link: /react.html head: - - meta - name: robots content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' - - meta - name: googlebot content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' - - meta - name: bingbot content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' ---

Low Dependency Surface

Built to fit the Laravel and Inertia stack you already use without adding heavy extra setup.

Almost Zero Config

Add the package, register it once, and it works with your app structure in a familiar way.

Laravel Helper

Flash toast payloads from controllers with a single toast() call.

Inertia Flash

Share toast data through Inertia without page-level wiring.

Vue Setup

Register the Vue plugin once for toasts and confirmation dialogs.

React Setup

Use the provider or initializer once in your React app.

Typed Frontend API

Use typed plugin options, positions, modal options, and composables in Vue 3 or React projects.

Confirm Flows

Handle delete and danger actions with promise-based confirmations.

## Quick example ::: code-group ```php [Laravel Controller] public function store() { // Persist your record... toast('Post created successfully', 'success', 'Saved'); return redirect()->route('posts.index'); } ``` ```ts [resources/js/app.ts] import { createApp, h } from 'vue'; import { createInertiaApp } from '@inertiajs/vue3'; import ToastPlugin from '@erag/inertia-toast-vue'; import '@erag/inertia-toast-vue/style.css'; createInertiaApp({ resolve: (name) => { const pages = import.meta.glob('./Pages/**/*.vue', { eager: true }); return pages[`./Pages/${name}.vue`]; }, setup({ el, App, props, plugin }) { createApp({ render: () => h(App, props) }) .use(plugin) .use(ToastPlugin, { position: 'bottom-right', }) .mount(el); }, }); ``` ```vue [Vue Component] ``` ```tsx [React Page] import { router } from '@inertiajs/react'; import { useConfirmation, useToast } from '@erag/inertia-toast-react'; export default function PostsIndex() { const toast = useToast(); const confirmation = useConfirmation(); const showToast = () => { toast.success('Profile updated successfully', 'Saved'); }; const destroyPost = async (id: number) => { const accepted = await confirmation.confirm({ title: 'Delete post', message: 'This action cannot be undone.', type: 'danger', confirmText: 'Delete', }); if (!accepted) { toast.info('Delete cancelled', 'Cancelled'); return; } router.delete(route('posts.destroy', id)); }; return ; } ``` ::: ### All toast props are dynamic The Laravel helper supports full per-toast customization: ```php toast( string $message, string $type = 'success', ?string $title = null, int $duration = 3000, ?string $position = null ); ``` That means: - `message` is the main text shown in the toast - `type` changes the variant like `success`, `error`, `warning`, or `info` - `title` adds an optional heading - `duration` controls auto close time in milliseconds - `position` can override the default plugin position for one specific toast ### Full dynamic example ```php public function store() { // Persist your record... toast( message: 'Post created successfully', type: 'success', title: 'Saved', duration: 3000, position: 'top-right', ); return redirect()->route('posts.index'); } ``` With the same helper, you can also send different kinds of toasts without changing frontend setup: ```php toast('Draft saved automatically', 'info', 'Auto Save', 2500, 'bottom-right'); toast('Unable to publish post', 'error', 'Publish failed', 5000, 'top-center'); toast('Connection lost', 'warning', 'Network issue', 0, 'bottom-center'); ``` ## Why this package `Laravel Inertia Toast` connects Laravel flash messages to an Inertia-powered Vue 3 or React UI without extra wiring in every page. It is built for apps that want: - a simple backend helper for redirect-based notifications - a Vue or React API for client-side toasts - a reusable confirmation modal for destructive actions - automatic sharing through the Laravel `web` middleware group - minimal app-level configuration - dynamic props for every individual toast