Badge

Highlights system-generated metadata associated with a larger object.

On this page

This docs is LLM-friendly and available as clean Markdown.

Supported browser agents can also use WebMCP to search, read, and open these docs. Learn more

Usage

import { GlBadge } from "gitlab-ui-react/badge";
<GlBadge>Maintainer</GlBadge>

Default

Use a badge to emphasize system-generated metadata such as status, progress, or product tier. Keep it next to the object it describes; use plain text when the metadata does not need emphasis.

Default badge
Badge

Variants

Choose a variant for the metadata’s meaning. Neutral is the default, info indicates noteworthy or active progress, success indicates a desired result, warning signals a non-critical problem, danger identifies a critical problem, and tier identifies a product tier.

Badge variants
NeutralRunningPassedPendingFailedUltimate

Icons

Add an icon only when it reinforces or directly communicates the metadata. An icon-only badge requires an aria-label that describes its meaning rather than the icon’s name.

Badges with icons
OpenClosed

Set href when the badge should navigate to the object it describes. Otherwise, badges are static and should not be used as buttons.

Badge link

Accessibility

  • Keep the badge beside the content it describes. If that relationship is not clear, associate the content with the badge using aria-describedby.
  • Give icon-only badges a descriptive aria-label. They automatically receive role="img"; icons next to visible text are hidden from assistive technology.
  • Add visually hidden context when a value is ambiguous on its own, such as explaining what a numeric badge counts.
  • Do not rely on color alone to communicate a badge’s meaning.
  • Use href only for navigation and provide a meaningful destination.

API

These are the component-specific props. GlBadge also forwards supported DOM attributes and exposes a ref to the rendered element.

Prop Description Default
variant Sets the semantic style to neutral, info, success, warning, danger, or tier. "neutral"
icon Adds an icon from the GitLab SVG library before the text.
iconSize Sets the icon to sm (12px) or md (16px). "md"
iconOpticallyAligned Adjusts the spacing of circular icons. Known issue status icons are adjusted automatically. false
href Renders the badge as a link and ignores tag.
active Applies the active link appearance when href is set. false
disabled Prevents link activation and removes it from the Tab order when href is set. false
target Sets the link browsing context when href is set. "_self"
rel Sets the link relationship when href is set.
tag Changes the non-link element. "span"
render Composes the badge or badge link onto a custom React element.
children Provides the badge’s visible text or other inline content.