Skip to content

Badges

Learn how to use the Badge component from Starlight to display status indicators, version numbers, and labels with different variants and sizes.

The Badge component is used to display short pieces of information such as status indicators, version numbers, labels, or tags. It provides visual emphasis for important metadata and helps categorize content. The Badge component supports different variants, sizes, and styling options to fit various use cases.

Prop NameProp TypeDescription
textstringThe text content to display in the badge
variant'tip' | 'caution' | 'note' | 'success' | 'danger'The variant that determines the badge’s color and styling
size'small' | 'medium' | 'large'The size of the badge (optional, defaults to medium)

The simplest form of badges using the Badge component from Starlight.

New Deprecated Six 200 Experimental

The Badge component supports different variants that convey different meanings:

<Badge text="New Feature" variant="tip" />
New Feature
<Badge text="Deprecated" variant="caution" />
Deprecated
<Badge text="Information" variant="note" />
Information
<Badge text="Stable" variant="success" />
Stable
<Badge text="Breaking Change" variant="danger" />
Breaking Change

Badges come in different sizes to fit various contexts:

<Badge text="Small" variant="tip" size="small" />
Small
<Badge text="Medium" variant="tip" size="medium" />
Medium
<Badge text="Large" variant="tip" size="large" />
Large

Badges work well when used alongside other content to provide additional context:

**API Endpoint** <Badge text="v2.0" variant="success" /> - Current stable version
**Legacy Feature** <Badge text="Deprecated" variant="caution" /> - Will be removed in v3.0
**Experimental** <Badge text="Beta" variant="danger" /> - Use with caution

API Endpoint v2.0 - Current stable version

Legacy Feature Deprecated - Will be removed in v3.0

Experimental Beta - Use with caution

You can use multiple badges together to show different types of information:

<Badge text="v1.2.0" variant="success" />
<Badge text="Stable" variant="tip" />
<Badge text="TypeScript" variant="note" />
v1.2.0 Stable TypeScript
  • Use badges to highlight important status information
  • Choose appropriate variants that match the semantic meaning
  • Keep badge text short and descriptive
  • Use consistent badge variants across similar content types
  • Consider the size context when choosing badge sizes
  • Don’t overuse badges as they can create visual clutter

  • Don’t use badges for navigation - Use proper navigation components instead
  • Don’t make badge text too long - Keep it concise and scannable
  • Don’t use badges without clear purpose - Each badge should provide valuable information
  • Don’t mix different badge styles inconsistently - Maintain visual consistency
  • Don’t use badges for essential information - Important content should be in the main text
  • Don’t create custom badge variants - Stick to the provided variants for consistency