Badge Component
The Blazor Badge component is provided by the platform-specific Ignite UI for Blazor package and is used in conjunction with avatars, navigation menus, or other components in an application when a visual notification is needed. Badges are usually designed with predefined styles to communicate information, success, warnings, or errors.
Live Demo
The Blazor Badge demo shows how the component can communicate a compact status or notification next to another interface element.
Anatomy
The Blazor Badge presents a compact label or dot indicator that decorates another interface element.
2. Icon: Represents the type of status or action.
3. Container: The badge shape that holds and styles the icon or label.
4. Label: Text or a number displayed inside the badge.
The component renders its content inside the base CSS part. Use the component’s default slot for text or other inline content; when dot is enabled, the badge renders as an indicator without content.
<igc-badge>
└── ::part(base)
└── default slot content
</igc-badge>
Getting Started
To use the Blazor Badge, follow the Ignite UI for Blazor Getting Started topic for the basic project setup, then register the component for your target platform.
Register the Ignite UI for Blazor services:
// in Program.cs file
builder.Services.AddIgniteUIBlazor();
Registering IgbBadgeModule, the Badge’s client resource module, is optional: the component loads its resources when it first renders. Listing it in builder.Services.AddIgniteUIBlazor(typeof(IgbBadgeModule)) can be used to preload resources or to support elements created only on the client (see Component Modules).
You will also need to link an additional CSS file to apply the styling to the IgbBadge component. The following needs to be placed in the app’s host page (wwwroot/index.html in a standalone Blazor WebAssembly or Blazor Hybrid app, Pages/_Host.cshtml in a Blazor Server app, Components/App.razor in a Blazor Web App):
<link href="_content/IgniteUI.Blazor/themes/light/bootstrap.css" rel="stylesheet" />
The simplest way to start using the IgbBadge is as follows:
<IgbBadge />
Usage
Use the Blazor Badge to display a short status, category, count, or notification indicator alongside another component.
The following example shows a success Badge displayed on an Avatar. Import the Badge and Avatar components from the platform-specific package, then place the Badge inside a relatively positioned wrapper.
Register the Ignite UI for Blazor services:
// in Program.cs file
builder.Services.AddIgniteUIBlazor();
Add the components to your Razor markup:
<div class="wrapper">
<IgbAvatar Icon="person" Shape="AvatarShape.Circle" Size="AvatarSize.Small" />
<IgbBadge Icon="check" Variant="@StyleVariant.Success" />
</div>
Use a relatively positioned wrapper to place the Badge over the Avatar:
.wrapper {
position: relative;
margin-top: 15px;
}
Type
The Ignite UI for Blazor Badge can carry different types of content, such as a number or an icon.
Use the value property to display text or a numeric count inside the Badge:
<IgbBadge Variant="@StyleVariant.Primary">12</IgbBadge>
You can also project content directly. When projecting both an icon and text, wrap the text to keep the correct padding.
<IgbBadge>
<IgbIcon Name="bluetooth" />
<span>Bluetooth</span>
</IgbBadge>
Icon
Add an icon as child content inside the Badge:
<IgbBadge Variant="@StyleVariant.Success">
<IgbIcon Name="heart-monitor" />
</IgbBadge>
For custom icons, register the icon with the platform’s icon service and render it as child content inside the Badge.
For example, register an SVG icon before using it in the Badge:
@code {
private IgbIcon icon;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender && icon != null)
{
await icon.EnsureReady();
await icon.RegisterIconFromTextAsync(
"heart-monitor",
"<svg viewBox=\"0 0 24 24\"><path d=\"M3 12h4l2-6 4 12 2-6h6\" /></svg>",
"custom");
}
}
}
Dot
The Ignite UI for Blazor Badge can also render as a minimal dot indicator for notifications by setting its dot attribute. Dot badges do not support content, but they can be outlined and can use any of the available dot types (for example, primary, success, or info).
Set the dot attribute to render a minimal notification indicator without content:
<IgbBadge Dot="true" />
Size
Control the Badge size with the --size CSS variable. For text badges smaller than 16px, also adjust the font size and line height:
igc-badge {
--size: 12px;
font-size: calc(var(--size) / 2);
line-height: normal;
}
Shape
The badge component supports rounded(default) and square shapes. These values can be assigned to the Shape attribute.
<IgbBadge Shape="@BadgeShape.Square" />
When the badge has a square shape, it can be further customized by setting a custom border radius using the --border-radius CSS variable.
Variants
The Ignite UI for Blazor Badge supports several pre-defined stylistic variants (Primary, Info, Success, Warn, and Error). Assign one of the supported values — primary, info, success, warning, or danger — to the variant attribute.
<IgbBadge Variant="@StyleVariant.Success" />
Outlined
The badge can also have a subtle border around it when the outlined attribute is set.
<IgbBadge Outlined="true" />
The border color of the outlined badge can also be customized using the --border-color CSS variable.
Do/Don’t
When to use: Use a Badge to communicate a short status, category, count, or notification state alongside another component. Use dot when the indicator does not need visible text.
When not to use: Do not use a Badge as the primary control for an action, as a replacement for a form validation message, or when the status cannot be understood from the badge content, surrounding context, or accessible labeling.
| Do | Don’t |
|---|---|
![]() | ![]() |
Properties
The Blazor Badge exposes platform-specific properties for controlling its content, appearance, and indicator behavior.
The Blazor Badge exposes the following properties.
| name | type | default | description |
|---|---|---|---|
dot |
boolean | false |
Renders the Badge as a dot indicator. |
outlined |
boolean | false |
Displays an outline around the Badge. |
shape |
BadgeShape | rounded |
Sets the Badge shape. |
variant |
StyleVariant | primary |
Sets the Badge stylistic variant. |
Styling
The Blazor Badge uses the IgbBadge component’s base CSS part and documented styling variables to customize its appearance.
Sass Theming
Use the Ignite UI for Blazor theme system to style the Badge consistently with the rest of your application.
CSS Variables
| variable | what it changes |
|---|---|
--background-color |
The badge background color. |
--border-color |
The badge border color. |
--border-radius |
The badge corner radius. |
--elevation |
The badge shadow. |
--icon-color |
The badge icon color. |
--text-color |
The badge text color. |
--size |
The badge size. |
--dot-size |
The size of the dot-type badge. |
Style Parts
| part | what it styles |
|---|---|
base |
The Badge root element. |
igc-badge::part(base) {
--background-color: var(--ig-error-A100);
--border-radius: 2px;
}
Styling with Tailwind
You can style the Badge with the custom Tailwind utility classes from igniteui-theming. Make sure to set up Tailwind first, then import the Ignite UI utilities in your global stylesheet:
@import "tailwindcss";
@import "igniteui-theming/tailwind/utilities/material.css";
<IgbBadge Class="!light-badge ![--background:#FF4E00] ![--border-radius:4px]"></IgbBadge>
The exclamation mark (!) gives the Tailwind utility precedence over the Badge’s default theme styles.
Accessibility
The Blazor Badge is a non-interactive status visual that communicates a short count, state, or notification.
Keyboard Interaction
The Badge does not receive focus, handle keyboard input, or expose component interaction events.
| Key | Action |
|---|---|
| n/a | The Badge is not keyboard interactive. |
Screen Readers / ARIA
The Badge host uses role="status" to expose its content as status information.
- The component sets
aria-roledescriptionto identify the Badge and its currentvariant. - Add an
aria-labelwhen a Badge without text, including adotBadge, communicates status that is not otherwise available to assistive technology. - Keep the Badge content or accessible label specific to the decorated item, such as
3 unread messagesrather than only3.
Accessibility Compliance
Infragistics documents Ignite UI for Blazor accessibility support for Section 508 and WCAG 2.1 guideline areas in the Accessibility Compliance topic.
| Criterion | How the component complies |
|---|---|
| 4.1.2 Name, Role, Value | The Badge exposes the semantic status role. The xplat implementation also exposes a role description based on the current variant; Angular exposes an accessible label and a role description based on its type and content. |
Your responsibilities:
- Provide an accessible name that explains the status when the Badge has no meaningful text, especially for
dotBadges. - Do not use Badge color as the only indication of status; pair it with text, an icon, or another accessible cue.
- Keep sufficient contrast between the Badge foreground and background when overriding theme styles.
Troubleshooting
Use this section to check boundaries and common decisions before treating Badge as an interactive control or the only indication of status.
Why does my custom background color not change the Badge?
The selected variant takes precedence over the --background-color CSS variable. To use a custom background color, avoid setting a variant that applies its own background color.
Why is my dot Badge not displaying content?
The dot property renders the Badge as a minimal indicator and does not support content. Use a regular Badge when you need to display text or other inline content.
Known Limitations
The Blazor Badge has the following platform-independent limitations.
- A dot Badge is an indicator only and cannot display text or an icon.
- Badge styling and variant/type names differ between Angular and the other supported frameworks. Use the platform-specific examples and API links on this page rather than copying an attribute between frameworks.
- The Badge is a visual status indicator and does not provide keyboard interaction of its own.
API References
Dependencies
The Blazor Badge requires a theme stylesheet to apply its visual styling. See the framework-specific setup in Getting Started.
Additional Resources
The following resources provide additional Blazor Badge guidance and project support.
Related Components
The Blazor Badge is commonly used with related components such as Avatar when a status indicator belongs to another visual element.
- Avatar — combine an Avatar with a Badge to show a status indicator.
FAQ
Yes. Use the Badge’s content area for the text and the supported icon content for the visual indicator. Keep the combination short so it remains a compact status or category label.
Set the platform-specific dot property or attribute. A dot Badge intentionally renders without text or other content.
Use a dot Badge when the status is communicated by presence alone. Use a text Badge when users need the status, category, or count to be understandable without relying on color or position.
Use igniteui-angular for Angular, igniteui-react for React, igniteui-webcomponents for Web Components, and IgniteUI.Blazor for Blazor. Keep related Ignite UI packages on the same release version.

