Toast
Temporary notifications that appear above the page. Mount a single toaster in your layout, then dispatch slate-toast events from anywhere. Requires Alpine.js.
API freeze: the
slate-toastevent name anddetailfields (id,title,description,variant,duration) are frozen — see API freeze.
Usage
Variants
Use variant: default, destructive, success, warning, or info.
Layout toaster
Mount once near the root of your app (teleports to body):
example.blade.php
<x-slate::toaster position="bottom-end" />
Then fire toasts from anywhere:
script.js
window.dispatchEvent(new CustomEvent('slate-toast', {
detail: {
title: 'Copied',
description: 'Link copied to clipboard.',
}
}))
Or with Alpine:
example.blade.php
<x-slate::button @@click="$dispatch('slate-toast', { title: 'Saved' })">
Save
</x-slate::button>
Static toast
Compose a toast card without the viewport:
Invite sent
We've emailed your teammates a join link.
Composition
code
Toaster (layout, once)
└── Toast stack (Alpine)
Toast
├── ToastTitle
├── ToastDescription
├── ToastAction
└── ToastClose
API
Toaster
| Prop | Default | Notes |
|---|---|---|
position |
bottom-end |
top-start, top-center, top-end, bottom-start, bottom-center, bottom-end |
duration |
4000 |
Auto-dismiss ms; 0 keeps until closed |
Event payload (slate-toast)
| Field | Notes |
|---|---|
title |
Bold heading |
description |
Supporting text |
variant |
default | destructive | success | warning | info |
duration |
Overrides toaster default |