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
Code
@* 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:
izzy add component Toast --at <file>:<line>Mode support
| Feature | Static | Interactive |
|---|---|---|
| Everything | Yes | Yes |
Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.
Accessibility
- It renders an
Alertthat 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
| Prop | Type | Default |
|---|---|---|
StatusWhat the message means; sets the icon. | Status | Status.Info |
TitleThe bold first line. | string? | |
ChildContentThe message, and any AlertActions written last in it. | RenderFragment? | |
VariantHow it's drawn. | AlertVariant | AlertVariant.Outline |
DismissibleShows the close button. | bool | true |
DismissLabelThe close button's accessible name. | string? | "Dismiss" |
Plus 17 item props and 4 common props.
Full APISee also
- ToastRegion: shows toasts from any render mode, even after a redirect.
- Alert: shows a status message about part of a page.