Appearance
Laravel Inertia ToastNotifications and confirmation dialogs for Laravel + Inertia + Vue 3 + React
Dynamic toast messages and confirm dialogs for your Laravel Inertia app.
Dynamic toast messages and confirm dialogs for your Laravel Inertia app.
Built to fit the Laravel and Inertia stack you already use without adding heavy extra setup.
Add the package, register it once, and it works with your app structure in a familiar way.
Flash toast payloads from controllers with a single toast() call.
Share toast data through Inertia without page-level wiring.
Register the Vue plugin once for toasts and confirmation dialogs.
Use the provider or initializer once in your React app.
Use typed plugin options, positions, modal options, and composables in Vue 3 or React projects.
Handle delete and danger actions with promise-based confirmations.
public function store()
{
// Persist your record...
toast('Post created successfully', 'success', 'Saved');
return redirect()->route('posts.index');
}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);
},
});<script setup lang="ts">
import { useConfirmation, useToast } from '@erag/inertia-toast-vue';
import { router } from '@inertiajs/vue3';
const { confirm } = useConfirmation();
const toast = useToast();
const showToast = () => {
toast.success('Profile updated successfully', 'Saved');
};
const destroyPost = async (id: number) => {
const accepted = await confirm({
title: 'Delete post',
message: 'This action cannot be undone.',
type: 'danger',
confirmText: 'Delete',
});
if (!accepted) {
return;
}
router.delete(route('posts.destroy', id));
};
</script>
<template>
<button type="button" @click="showToast">
Show toast
</button>
</template>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 <button onClick={showToast}>Show toast</button>;
}The Laravel helper supports full per-toast customization:
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 toasttype changes the variant like success, error, warning, or infotitle adds an optional headingduration controls auto close time in millisecondsposition can override the default plugin position for one specific toastpublic 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:
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');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:
web middleware group