Badge

Small count or label chips — variants, pill shape, positioned on buttons and headings.

Basic

Html.BadgeBuilder(text) renders a span badge. SetBadgeVariant(VariantStyle) applies a Bootstrap colour.

PrimarySecondarySuccessWarningDangerInfoDarkLight

Basic badge

This is a badge An other badge Here is a badge
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@Html.BadgeBuilder("This is a badge").SetBadgeVariant(VariantStyle.Secondary)
@Html.BadgeBuilder("An other badge").SetBadgeVariant(VariantStyle.Dark)
@Html.BadgeBuilder("Here is a badge").SetBadgeVariant(VariantStyle.Warning)

Pill

SetBadgePill() applies rounded corners — useful for counts and tag-like labels.

PrimarySecondarySuccessWarningDangerInfoDarkLight

Pill badge

This is a badge An other badge Here is a badge
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@Html.BadgeBuilder("This is a badge").SetBadgeVariant(VariantStyle.Secondary).SetBadgePill()
@Html.BadgeBuilder("An other badge").SetBadgeVariant(VariantStyle.Dark).SetBadgePill()
@Html.BadgeBuilder("Here is a badge").SetBadgeVariant(VariantStyle.Warning).SetBadgePill()

In headings

Badges placed inline inside a heading inherit the surrounding font size automatically.

In headings

Releases

New

Documentation

Updated
API
v2
Beta
Experimental
C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("d-flex flex-column gap-2").Begin())
{
    @using (Html.FlexBlockBuilder().SetAlignItemsCenter().WithGap(Old_Gap.Gap2).Begin())
    {
        @Html.TitleBuilder().SetTitle("Releases", TitleLevel.Three).Render()
        @Html.BadgeBuilder("New").SetBadgeVariant(VariantStyle.Primary).SetBadgePill()
    }
    @using (Html.FlexBlockBuilder().SetAlignItemsCenter().WithGap(Old_Gap.Gap2).Begin())
    {
        @Html.TitleBuilder().SetTitle("Documentation", TitleLevel.Four).Render()
        @Html.BadgeBuilder("Updated").SetBadgeVariant(VariantStyle.Info).SetBadgePill()
    }
    @using (Html.FlexBlockBuilder().SetAlignItemsCenter().WithGap(Old_Gap.Gap2).Begin())
    {
        @Html.TitleBuilder().SetTitle("API", TitleLevel.Five).Render()
        @Html.BadgeBuilder("v2").SetBadgeVariant(VariantStyle.Secondary)
    }
    @using (Html.FlexBlockBuilder().SetAlignItemsCenter().WithGap(Old_Gap.Gap2).Begin())
    {
        @Html.TitleBuilder().SetTitle("Beta", TitleLevel.Six).Render()
        @Html.BadgeBuilder("Experimental").SetBadgeVariant(VariantStyle.Warning)
    }
}

Button notification

SetHiddenText(string) adds a visually-hidden accessibility label. The badge sits naturally after the button text.

Button badge

C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
<button type="button" class="btn btn-primary">
    Notifications
    @Html.BadgeBuilder("+99").SetBadgeVariant(VariantStyle.Danger).SetBadgePill()
</button>
<button type="button" class="btn btn-primary">
    Notifications
    @Html.BadgeBuilder("+99").SetBadgeVariant(VariantStyle.Light).SetBadgePill()
</button>
<button type="button" class="btn btn-primary">
    Notifications
    @Html.BadgeBuilder("+99").SetBadgeVariant(VariantStyle.Success).SetBadgePill()
</button>

Positioned

SetPosition(Position.Absolute) with SetTop, SetStart and SetTranslate places the badge on the button corner.

Positioned badge

C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("d-flex flex-wrap gap-4").Begin())
{
    @Html.Button(ActionItemFactory.Url("Inbox", "#").SetVariant(VariantStyle.Primary).SetBadge("99+", VariantStyle.Danger)).Render()
    @Html.Button(ActionItemFactory.Url("Notifications", "#").SetVariant(VariantStyle.Secondary).SetBadge("5", VariantStyle.Success)).Render()
}

Indicator dot

SetAsNotification() renders a small dot with no visible text — SetHiddenText provides an accessible label.

Indicator dot

C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.BlockBuilder().AddClass("d-flex flex-wrap gap-4").Begin())
    { 
        @Html.Button(ActionItemFactory.Url("Profile", "#").SetVariant(VariantStyle.Primary).SetBadge("", VariantStyle.Danger)).Render()
        @Html.Button(ActionItemFactory.Url("Messages", "#").SetVariant(VariantStyle.Secondary).SetOutlined().SetBadge("", VariantStyle.Success)).Render()
    }