New to Telerik UI for BlazorStart a free 30-day trial

Appearance Settings

The Badge component features built-in appearance parameters that allow you to customize virtually every aspect of its look and feel.

FillMode

You can toggle the Badge border and background by setting the FillMode parameter to a member of the Telerik.Blazor.ThemeConstants.Badge.FillMode class:

Class membersManual declarations
Solid (default value)solid
Flatflat
Outlineoutline

Refer to the example below to customize the available parameters and observe their impact on the Badge component.

Rounded

The Rounded parameter applies the border-radius CSS rule to the Badge and lets you curve its edges. You can set it to a member of the Telerik.Blazor.ThemeConstants.Badge.Rounded class:

Class membersManual declarations
Smallsm
Mediummd
Largelg
Full (default value)full

Refer to the example below to customize the available parameters and observe their impact on the Badge component.

Size

You can increase or decrease the size of the Badge by setting the Size parameter to a member of the Telerik.Blazor.ThemeConstants.Badge.Size class:

Class membersManual declarations
Smallsm
Medium (default value)md
Largelg

Refer to the example below to customize the available parameters and observe their impact on the Badge component.

ThemeColor

You can change the color of the Badge by setting the ThemeColor parameter to a member of the Telerik.Blazor.ThemeConstants.Badge.ThemeColor class:

Class membersManual declarations
Basebase
Primaryprimary
Secondarysecondary
Tertiarytertiary
Infoinfo
Successsuccess
Warningwarning
Errorerror
Darkdark
Lightlight
Inverseinverse

Refer to the example below to customize the available parameters and observe their impact on the Badge component.

Example

The following example lets you experiment with the available settings that control the appearance of the Badge. It starts with the default component behavior.

<div class="container">
    <div class="row">
        <div class="col-md-3">
            <label>
                Theme Color
                <TelerikDropDownList Data="@ThemeColors" @bind-Value="@ThemeColor"></TelerikDropDownList>
            </label>
        </div>
        <div class="col-md-3">
            <label>
                FillMode
                <TelerikDropDownList Data="@FillModes" @bind-Value="@FillMode"></TelerikDropDownList>
            </label>
        </div>
        <div class="col-md-3">
            <label>
                Rounded
                <TelerikDropDownList Data="@RoundedValues" @bind-Value="@Rounded"></TelerikDropDownList>
            </label>
        </div>
        <div class="col-md-3">
            <label>
                Size
                <TelerikDropDownList Data="@Sizes" @bind-Value="@Size"></TelerikDropDownList>
            </label>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12 text-center">
            <TelerikButton>
                Notifications
                <TelerikBadge ThemeColor="@ThemeColor"
                              Rounded="@Rounded"
                              FillMode="@FillMode"
                              Size="@Size">
                    10
                </TelerikBadge>
            </TelerikButton>
        </div>
    </div>
</div>

@code {
    private string ThemeColor { get; set; } = ThemeConstants.Badge.ThemeColor.Primary;
    private List<string> ThemeColors { get; set; } = new List<string>()
    {
        "base",
        "primary",
        "secondary",
        "tertiary",
        "info",
        "success",
        "warning",
        "error",
        "dark",
        "light",
        "inverse"
    };

    private string FillMode { get; set; } = ThemeConstants.Badge.FillMode.Solid;
    private List<string> FillModes { get; set; } = new List<string>()
    {
        "solid",
        "flat",
        "outline"
    };

    private string Rounded { get; set; } = ThemeConstants.Badge.Rounded.Full;
    private List<string> RoundedValues { get; set; } = new List<string>()
    {
        "sm",
        "md",
        "lg",
        "full"
    };

    private string Size { get; set; } = ThemeConstants.Badge.Size.Medium;
    private List<string> Sizes { get; set; } = new List<string>()
    {
        "sm",
        "md",
        "lg"
    };
}