Command Palette

Search for a command to run...

Components · Core component

Badge

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

TSX
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

PropTypeDefaultDescription
children*ReactNode—The content to render inside the Badge. Typically composed of `<Badge.Icon>` and `<Badge.Label>`.
classNamestring—Optional custom CSS class to apply to the root badge element.
data-rac-idstring—A unique identifier for tracking purposes.
data-testidstring—A unique identifier for automated testing purposes.
intentenum'neutral'The semantic intent of the badge, which dictates its colors and default icon. - `neutral` - `info` - `success` - `warning` - `danger` - `special`
variantenum'subtle'The visual appearance style of the badge. - `solid` - `subtle` - `plain`

Badge.Icon

PropTypeDefaultDescription
classNamestring—

Badge.Label

PropTypeDefaultDescription
classNamestring—