usernotnull/tall-toasts
Beautiful, customizable toast notifications for Laravel + Livewire (TALL stack). Trigger toasts globally from controllers, Blade, Livewire components, Alpine, or plain JS. Lightweight UI with Tailwind styling, themes, positions, and stacking behavior.
Start by installing the package via Composer:
composer require usernotnull/tall-toasts
Then follow the minimal setup steps:
<livewire:toasts /> near the top of your <body> in your main layout (e.g., layouts/app.blade.php).resources/js/app.js:
import { Alpine, Livewire } from 'livewire';
import ToastComponent from 'tall-toasts'; // or full vendor path if not auto-discovered
Alpine.plugin(ToastComponent);
Alpine.start();
WireToast trait in Livewire components that trigger toasts.vendor/usernotnull/tall-toasts/resources/views/**/*.blade.php is included in Tailwind’s content for JIT.First use case: Display a success toast from a Livewire component action:
use Livewire\Component;
use Usernotnull\Toast\Concerns\WireToast;
class SaveForm extends Component
{
use WireToast;
public function submit()
{
// ... save logic ...
toast()->success('Form saved successfully!')->push();
}
}
toast() helper anywhere — controllers, views, components — to queue toasts for the next page load (via pushOnNextPage()) or immediate (via push()).toast()
->danger('Critical error!', 'Oops')
->duration(0) // sticky
->doNotSanitize() // enables HTML like <br>, <strong>
->push();
debug() to only show in non-production environments (also logs to Laravel log).document.addEventListener('alpine:init', () => {
Alpine.data('searchForm', () => ({
async submit() {
// ... validation ...
Toast.success('Search results updated', 'Done', 3000);
}
}));
});
success, info, warning, danger, debug) accept (message, title?, duration?).WireToast trait in components that call toast() during a Livewire request. Without it, toasts may not display or repeat on refresh.toast() directly in Blade (e.g., @php toast()->info('Welcome!')->push(); @endphp).vendor:publish) to tweak content.blade.php, icon.blade.php, or toasts.blade.php — no external CSS needed since everything uses Tailwind classes.push() vs pushOnNextPage(): push() triggers now (use in redirects or non-Livewire), while pushOnNextPage() waits for next full page load (ideal for redirects from Livewire). Misusing them causes toasts to duplicate or disappear.WireToast trait in Livewire components that trigger toast() — results in silent toast failures.content paths in tailwind.config.js for JIT → missing toast styles or broken icons (especially icon.blade.php uses svg paths).doNotSanitize() on user-submitted content — security risk! Only use when trusted (e.g., system-generated messages).<livewire:toasts /> is before @livewireScriptConfig, and that app.js includes the plugin before Livewire.start().WireToast or using push() after redirect() (use pushOnNextPage() instead).npm run build after updating tailwind.config.js, and clear view cache: php artisan view:clear.duration(0) to create persistent toasts (e.g., for critical warnings).config/tall-toasts.php) to globally set duration or load_delay.debug() during development — it logs messages to Laravel log and only renders in APP_ENV=local.<html dir="rtl"> — the default layout supports this out-of-the-box.toasts.blade.php.How can I help you explore Laravel packages today?