Badges are used to highlight important information, alerts, or system statuses.
The default Badge component. By default, it uses the neutral intent and subtle variant.
It is composed using <Badge.Icon> and <Badge.Label>.
Usage
import { Badge } from '@console/nimbus-ui/core';Examples
Variant
Badges come in three structural variants: solid, subtle, and plain.
The plain variant removes the background padding and defaults to a Dot icon for a minimalist look.
Intent
Use the intent prop to communicate semantic meaning.
Changing the intent automatically updates the background, text color, and default icon.
Custom Icon
While <Badge.Icon> renders a default semantic icon, you can pass any custom SVG or component
as a child to override it. The icon will automatically inherit the correct intent color.
Loading
If you need a completely custom layout (e.g., an animated loading state or a raw number counter),
you can bypass the <Badge.Icon> and <Badge.Label> sub-components and pass custom children directly.
Custom Children
If you need a completely custom layout (e.g., an animated loading state or a raw number counter),
you can bypass the <Badge.Icon> and <Badge.Label> sub-components and pass custom children directly.
API
Badge
| Prop | Type | Default | Description |
|---|---|---|---|
| children* | ReactNode | — | The content to render inside the Badge. Typically composed of `<Badge.Icon>` and `<Badge.Label>`. |
| className | string | — | Optional custom CSS class to apply to the root badge element. |
| data-rac-id | string | — | A unique identifier for tracking purposes. |
| data-testid | string | — | A unique identifier for automated testing purposes. |
| intent | enum | 'neutral' | The semantic intent of the badge, which dictates its colors and default icon. - `neutral` - `info` - `success` - `warning` - `danger` - `special` |
| variant | enum | 'subtle' | The visual appearance style of the badge. - `solid` - `subtle` - `plain` |
Badge.Icon
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — |
Badge.Label
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — |
Figma