- Home
- /
- Design
- /
- DMBBootstrapBuilder
- /
- Toast
Toast
Short-lived notification messages — variants, subtitle, icon, auto-hide and custom body content.
Basic
Html.Toast() renders a Bootstrap toast. SetTitle and SetMessage provide the header and body text.
Basic toast
File saved
Your document has been saved successfully.
Settings have been updated.
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("toast-container position-static d-flex flex-column gap-2").Begin())
{
@(Html.Toast().SetTitle("File saved").SetMessage("Your document has been saved successfully.").Render())
@(Html.Toast().SetMessage("Settings have been updated.").Render())
}Variants
SetVariant(VariantStyle) colours the toast header — the same set available on alerts and modals.
Published
Page is now live.
Saved
All changes persisted.
Low storage
Less than 10 % remaining.
Error
Upload failed — please retry.
Info
Scheduled maintenance on Sunday.
Variants
Saved
All changes persisted.
Error
Upload failed — please retry.
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("toast-container position-static d-flex flex-column gap-2").Begin())
{
@(Html.Toast().SetTitle("Saved").SetMessage("All changes persisted.").SetVariant(VariantStyle.Success).Render())
@(Html.Toast().SetTitle("Error").SetMessage("Upload failed — please retry.").SetVariant(VariantStyle.Danger).Render())
}Subtitle & Icon
SetSubtitle(string) adds a small timestamp or context label. SetIcon(IconStruct) places an icon in the header.
Subtitle & icon
New comment2 min ago
Alice replied to your post.
Deployment finishedjust now
Version 2.4.1 is live on production.
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("toast-container position-static d-flex flex-column gap-2").Begin())
{
@(Html.Toast().SetTitle("New comment").SetSubtitle("2 min ago").SetMessage("Alice replied to your post.").SetVariant(VariantStyle.Primary).Render())
@(Html.Toast().SetTitle("Deployment finished").SetSubtitle("just now").SetMessage("Version 2.4.1 is live on production.").SetVariant(VariantStyle.Success).SetIcon(IconStruct.Bootstrap("bi-cloud-check")).Render())
}Auto-hide
SetAutoHide(false) keeps the toast visible until the user closes it — useful when a decision is required.
Auto-hide
Upload complete
3 files have been uploaded.
Action required
You must confirm before the changes are applied.
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("toast-container position-static d-flex flex-column gap-2").Begin())
{
@(Html.Toast().SetTitle("Upload complete").SetMessage("3 files have been uploaded.").SetVariant(VariantStyle.Success).SetIcon(IconStruct.Bootstrap("bi-upload")).Render())
@(Html.Toast().SetTitle("Action required").SetMessage("You must confirm before the changes are applied.").SetVariant(VariantStyle.Warning).SetIcon(IconStruct.Bootstrap("bi-exclamation-triangle")).SetAutoHide(false).Render())
}Custom body
.Begin() switches to wrapping mode — any HTML or builder content placed inside replaces the default message body.
Custom body
Publication queue2 min ago
3 documentation pages are waiting for publication.
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("toast-container position-static").Begin())
{
@using (Html.Toast().SetTitle("Publication queue").SetSubtitle("2 min ago").SetIcon(IconStruct.Bootstrap("bi-cloud-upload")).SetVariant(VariantStyle.Info).Begin())
{
@using (Html.BlockBuilder().AddClass("d-flex flex-column gap-2").Begin())
{
@using (Html.BlockBuilder().Begin())
{
@:3 documentation pages are waiting for publication.
}
@Html.ProgressBar().SetValue(66).SetVariant(VariantStyle.Info)
}
}
}
Session Consent : Consent to use session for this website