Badges & Status Indicators
Badges are compact visual indicators used to highlight document status, feature availability, version requirements, or categorical metadata inline without cluttering your prose.
How to Use Badges
Section titled “How to Use Badges”Call attention to feature statuses or version numbers using inline badges:
- Import Badge: Include
import { Badge } from '@astrojs/starlight/components';in your frontmatter. - Define Parameters: Set the
text,variant(e.g.,tip,note,danger), andsize. - Embed Inline: Drop the component directly into sentences or headings.
Behind the Curtain
Section titled “Behind the Curtain”How badges render visually on the live site.
- Standard: v1.0.0
- Production State: Stable
- Best Practice: Recommended
- Deprecation Warning: Legacy
- Breaking Notice: Critical
The raw code required to generate the badge elements.
import { Badge } from '@astrojs/starlight/components';
<Badge text="v1.0.0" variant="note"/><Badge text="Stable" variant="success"/><Badge text="Recommended" variant="tip"/><Badge text="Legacy" variant="caution"/><Badge text="Critical" variant="danger"/>How writers add this component using the Sveltia CMS visual interface.
Thanks to the custom badge component registered in public/admin/index.html, writers can insert badges directly in Rich Text mode:
In Rich Text Mode:
- Click the + (Add Block) button in the editor toolbar.
- Select Starlight Badge from the dropdown menu.
- Enter the Badge Text (e.g.,
v2.0orRequired). - Select your Color Variant (
default,note,tip,caution,danger,success) and Size.
In Raw Markdown Mode:
Use standard JSX tags: <Badge text="Production Ready" variant="success" size="medium" />
For a complete step-by-step walkthrough of visual component insertion, see Inserting Custom Components (CMS Magic).
