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.

Variants

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

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

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())