Toast
Mount a Toaster once; everything else is a plain function call from anywhere.
Loading documentation…
Mount <Toaster /> once, near the root. Everything after that is a plain
function call from anywhere in the application — no hook, no context, no
provider in your component tree, and nothing to thread through props.
timeout: 0 keeps a toast up until it is closed — the right choice for an
error the reader has to act on, and the wrong one for everything else.
toast.promise takes one toast through all three states and resolves to the
promise's own value, so it drops into an existing call without restructuring
it.
Every call returns an id.
The Toaster owns the corner, the stack limit and the default timeout.
Bottom-right is the default because it is the furthest corner from where the
work is happening.
Anything the reader must answer belongs in a Dialog;
anything they must keep reading belongs on the page. A toast is for something
that already happened.
The headline. Keep it to one line.
A second line — what exactly happened, or what to do next.
Milliseconds before auto-dismiss. 0 keeps it until closed.
Props for the action slot, passed through to Base UI.
The toned variants. Each returns the new toast's id.
Drives one toast through pending, fulfilled and rejected, and resolves to the promise's value.
Changes a toast in place. updates may be a function of the previous toast.
Closes one toast, or all of them.
The raw Base UI manager, for anything the shorthands do not cover.
The corner the stack lives in. It defaults to bottom-right.
How many stay visible before the oldest is dropped.
The default auto-dismiss, in milliseconds.