Skip to content

Badge

Displays a badge or a component that looks like a badge. Implements global theme configuration based on BrConfigProvider, providing flexible style customization capabilities.

Basic Usage

Default
Example

Colors

Use the color prop to control the color theme of the badge.

Default
Primary
Secondary
Success
Warning
Danger
Info
Carbon
Accent
Example

Dot Mode & Numeric Overflow

Used as a superscript attached to other elements, such as message notifications. Supports dot mode and numeric overflow truncation (e.g., 99+).

5
99+
10+
Example

Variants

Provides multiple visual variants to meet different design requirements.

Solid
Secondary
Outline
Soft
Example

Sizes

Provides multiple sizes to suit different layout needs.

Extra Small
Small
Default
Medium
Large
Extra Large
2X Large
Example

With Icon

You can use the icon slot to add a custom icon to the left of the badge content.

Featured
Completed
Warning
Example

Theming

BrBadge fully integrates with BrConfigProvider, allowing you to customize styles via global configuration or local class names.

Global Configuration (BrConfigProvider)

You can globally override badge design tokens such as background color, text color, and border radius via BrConfigProvider, supporting seamless switching between light and dark modes.

Global Theme Customization

Themed Badge
Outline Badge
Example

Local Customization (TailwindCSS)

If you only need to adjust the style of individual badges, you can pass TailwindCSS class names directly via the class prop, which will automatically override the default styles from BrConfigProvider.

Teal Badge
Square Pink
Example

API

Props

NameTypeDefaultDescription
variant'solid' | 'secondary' | 'outline' | 'soft''solid'Badge style variant
color'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'carbon' | 'accent''default'Badge color theme
size'default' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'icon''default'Badge size
dotbooleanfalseWhether to enable dot mode
valuenumber | string-Value to display, default slot is not needed when this is provided
maxnumber99Maximum value for numeric overflow, displays max+ when exceeded
disabledbooleanfalseWhether the badge is disabled
standalonebooleanfalseWhether to force standalone positioning, use with relative parent container
asstring'div'The HTML tag to render as
classany-Custom CSS class names

Slots

NameDescription
defaultCustom badge content. If dot mode is used and it wraps other elements, this slot is for the wrapped target element.
iconCustom badge icon, displayed to the left of the content.