Toast

Shows a brief message that stacks, follows a promise and swipes away.

View as Markdown

Installation

Usage

Render Toaster once, around your app.

Then call toast.add from anywhere, even outside React.

Composition

Types

Use type to add an icon. Leave it out for text only.

Action

Use actionProps to add a button. Keep it to one action. A label too long to sit beside the text drops under it.

Promise

Use toast.promise to show a loading toast that turns into success or error.

Dismiss

Use timeout: 0 to keep a toast until it's closed. Use toast.close to close one by id, or all of them.

Custom Layout

Toaster renders the Composition tree for every toast. To change it, render your own list inside ToastViewport with useToastManager().

API Reference

Every part takes sx to override its styles. The rest is Base UI's Toast.

toast

Options