You’re browsing the documentation for an old version of Flux. Go to v2.x ->

Toast

A message that provides feedback to users about an action or event, often temporary and dismissible.

To use the Toast component from Livewire, you must include it somewhere on the page; often in your layout file:

Copy to clipboard
<body>    <!-- ... -->    <flux:toast /></body>

If you are using wire:navigate to navigate between pages, you may want to persist the toast component so that toast messages don't suddenly disappear when navigating away from the page.

Copy to clipboard
<body>    <!-- ... -->    @persist('toast')        <flux:toast />    @endpersist</body>

Once the toast component is present on the page, you can use the Flux::toast() method to trigger a toast message from your Livewire components:

Copy to clipboard
<?phpuse Livewire\Component;use Flux;class EditPost extends Component{    public function save()    {        // ...        Flux::toast('Your changes have been saved.');    }}

You can also trigger a toast from Alpine directly using Flux's magic methods:

Copy to clipboard
<button x-on:click="$flux.toast('Your changes have been saved.')">    Save changes</button>

Or you can use the window.Flux global object to trigger a toast from any JavaScript in your application:

Copy to clipboard
<script>    let button = document.querySelector('...')    button.addEventListener('alpine:init', () => {        Flux.toast('Your changes have been saved.')    })</script>

Both $flux and window.Flux support the following method parameter signatures:

Copy to clipboard
Flux.toast('Your changes have been saved.')// Or...Flux.toast({    heading: 'Changes saved',    text: 'Your changes have been saved.',    variant: 'success',})

With heading

Use a heading to provide additional context for the toast.

Flux::toast(    heading: 'Changes saved.',    text: 'You can always update this in your settings.',);

Variants

Use the variant prop to change the visual style of the toast.

Flux::toast(variant: 'success', ...);Flux::toast(variant: 'warning', ...);Flux::toast(variant: 'danger', ...);

Positioning

By default, the toast will appear in the bottom right corner of the page. You can customize this position using the position prop.

<flux:toast position="top right" /><!-- Customize top padding for things like navbars... --><flux:toast position="top right" class="pt-24" />

Duration

By default, the toast will automatically dismiss after 5 seconds. You can customize this duration by passing a number of milliseconds to the duration prop.

// 1 second...Flux::toast(duration: 1000, ...);

Permanent

Use a value of 0 as the duration prop to make the toast stay open indefinitely.

// Show indefinitely...Flux::toast(duration: 0, ...);
Copyright © 2025 Wireable LLC ·Terms of Service
Built with by
Caleb Porzio and Hugo Sainte-Marie