Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Toast

Since 0.1.0-alpha.31
Draws one toast on the page, for previews and docs.

One toast drawn on the page, as ToastRegion draws it: a picture of it for a theme preview, a mockup or docs. To show people a toast, use ToastService and a ToastRegion, which place, announce and close them.

A toast on the page

A Toast looks like one in a ToastRegion, but it's part of the page: for a theme preview, a mockup or a help article. Set Status and Title, write the message inside, and put any button in AlertActions. To tell people something just happened, use ToastService instead.

Static

Preview

Success:
Changes saved
Q3 roadmap was updated.
Error:
Upload failed
budget.xlsx is over the 25 MB limit.

Code

Usage.razor
@* Toasts drawn on the page, as a theme preview or a help article shows them: a save, and a
   failed upload with a retry. *@
<Column Gap="3" Grow>
    <Toast Status="Status.Success" Title="Changes saved">Q3 roadmap was updated.</Toast>
    <Toast Status="Status.Danger" Title="Upload failed">
        budget.xlsx is over the 25 MB limit.
        <AlertActions><Button Size="ControlSize.Sm" Variant="ButtonVariant.Outline">Try again</Button></AlertActions>
    </Toast>
</Column>

Add this example to a page with the izzy CLI:

bash
izzy add component Toast --at <file>:<line>

Mode support

What works in each mode, Toast
FeatureStaticInteractive
EverythingYesYes

Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.

Accessibility

  • It renders an Alert that isn't announced, as it's part of the page from the start, not news.
  • The close control is the Alert's, named "Dismiss" (DismissLabel), and it closes the toast.

Parameters

Toast parameters
PropTypeDefault
StatusWhat the message means; sets the icon.StatusStatus.Info
TitleThe bold first line.string?
ChildContentThe message, and any AlertActions written last in it.RenderFragment?
VariantHow it's drawn.AlertVariantAlertVariant.Outline
DismissibleShows the close button.booltrue
DismissLabelThe close button's accessible name.string?"Dismiss"

See also

  • ToastRegion: shows toasts from any render mode, even after a redirect.
  • Alert: shows a status message about part of a page.

Connection lost

Rejoining the server…