Guides
Navigation
Feedback
Overlays
Layout
Data Display
Forms
.md

Feedback

toast

Toast region; dispatch a `toast` window event to show one.

Installation

php artisan ui:add toast

Usage

<x-ui.button
    onclick="window.dispatchEvent(new CustomEvent('toast', { detail: { title: 'Saved', description: 'Your changes have been saved.' } }))">
    Show toast
</x-ui.button>

{{-- One region per page. position: bottom-right (default), bottom-left,
     top-right, top-left or top-center. --}}
<x-ui.toast position="top-center" />

Ships its own inline <script>; no JS dependencies. Place once near </body>. Trigger with: window.dispatchEvent(new CustomEvent('toast', { detail: { title, description, duration } })). position: bottom-right|bottom-left|top-right|top-left.

Props

Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.

@props([
    'position' => 'bottom-right',
])