Usage
Toaster where the app mounts its other providers, then call toast from anywhere.
AlertDialog.Alert or Banner.toast shows a neutral message. toast.info, toast.success, toast.warning, and toast.error set the severity, which picks the icon and its status color and how urgently a screen reader reads the message. toast(message, { severity }) takes the severity as data.
The icon, the text, and the buttons center on each other when the message is a single line with no description. A toast with a description, or a title that wraps to more than one line, hangs them from the top edge instead, so the icon stays beside the first line. Nothing is configured for this; the toast measures its own text.
An action is a Button in the toast. Pressing it runs onClick, then dismisses the toast without calling onDismiss. Keep the label to a word or two. A toast does not navigate: do the navigation in onClick.
Pass an id. A second call with the same id updates the toast in place and restarts its timer instead of stacking another.
A toast shows in the Toaster of the document that owns source, usually the button that was pressed (source: event.currentTarget). A message from a detached window stays in that window when that window has a Toaster; otherwise it goes to the first Toaster mounted.
While a modal dialog or modal drawer is open, the stack moves into it so it stays above the dialog and keeps taking input. It moves back when the dialog closes.
The title, description, action label, region label, and close label are all LocalizedMessage. The component supplies no text.