- Home
- /
- Design
- /
- DMBBootstrapBuilder
- /
- Alert
- /
- home
- /
- alerts
Alert
Inline feedback messages — coloured, dismissible, with icons, titles and footer actions.
Variants
SetVariant(VariantStyle) applies a Bootstrap colour to the alert. SetMessage(string) sets the body text.
Primary alert — use for main call to action.
Secondary alert — supporting information.
Success alert — operation completed.
Warning alert — proceed with caution.
Danger alert — action cannot be undone.
Info alert — here is something to know.
Variants
Success alert — operation completed.
Danger alert — action cannot be undone.
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@(Html.AlertBuilder().SetMessage("Success alert — operation completed.").SetVariant(VariantStyle.Success).Render())
@(Html.AlertBuilder().SetMessage("Danger alert — action cannot be undone.").SetVariant(VariantStyle.Danger).Render())Title & Icon
SetTitle(string) adds a heading above the message. SetIcon(IconStruct) adds a leading icon next to it.
Title & icon
Deployment complete
All 3 services are running on production.Billing issue
Your payment method was declined. Update it before the next cycle.C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@(Html.AlertBuilder()
.SetTitle("Deployment complete")
.SetMessage("All 3 services are running on production.")
.SetVariant(VariantStyle.Success)
.Render())
@(Html.AlertBuilder()
.SetTitle("Billing issue")
.SetMessage("Your payment method was declined. Update it before the next cycle.")
.SetVariant(VariantStyle.Danger)
.SetIcon(IconStruct.Bootstrap("bi-exclamation-octagon"))
.Render())Dismissible
SetDismissible() adds a close button. Pass animated: true for a Bootstrap fade-out transition.
Dismissible
Updates available
A new version of the package is ready to install.Draft saved
Your changes have been saved automatically.C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@(Html.AlertBuilder()
.SetTitle("Updates available")
.SetMessage("A new version of the package is ready to install.")
.SetVariant(VariantStyle.Info)
.SetIcon(IconStruct.Bootstrap("bi-arrow-repeat"))
.SetDismissible()
.Render())
@(Html.AlertBuilder()
.SetTitle("Draft saved")
.SetMessage("Your changes have been saved automatically.")
.SetVariant(VariantStyle.Success)
.SetIcon(IconStruct.Bootstrap("bi-floppy"))
.SetDismissible(animated: true)
.Render())Footer actions
AddFooterAction(IActionItem) appends a button row below the message. Multiple actions can be chained.
Footer actions
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@(Html.AlertBuilder()
.SetTitle("Confirm deletion")
.SetMessage("This will permanently remove the selected records.")
.SetVariant(VariantStyle.Warning)
.SetIcon(IconStruct.Bootstrap("bi-trash"))
.AddFooterAction(ActionItemFactory.Url("Delete", "#", IconStruct.Bootstrap("bi-trash")).SetVariant(VariantStyle.Danger))
.Render())
@(Html.AlertBuilder()
.SetTitle("Review required")
.SetMessage("Changes are pending approval before publication.")
.SetVariant(VariantStyle.Primary)
.SetIcon(IconStruct.Bootstrap("bi-eye"))
.AddFooterAction(ActionItemFactory.Url("Review", "#", IconStruct.Bootstrap("bi-search")).SetVariant(VariantStyle.Primary))
.AddFooterAction(ActionItemFactory.Url("Dismiss", "#").SetVariant(VariantStyle.Secondary).SetOutlined())
.Render())
Session Consent : Consent to use session for this website