Badge
Compact status label for categories, states, and metadata.
- Selector
- ui-badge
- Package
- @ngnova/ui/badge
Import
import { UiBadgeComponent } from '@ngnova/ui/badge';Usage & variants
Live examples use the public ui-badge API, paired with the exact snippet a product team would paste into an Angular app.
Release status badges
Compact status label for categories, states, and metadata.
Production guidance
Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.
When to use
Use for short non-interactive labels such as Active, Beta, New, Warning, or count metadata.
Watch for
Keep badge text short; long content truncates, while Tag or Alert is better for longer copy.
Product recipes
Apply Badge in distinct, copyable product scenarios—not just an isolated component state.
Status badges
Pair semantic variants with domain status text.
1 2
<ui-badge variant="success" ariaRole="status">Active</ui-badge>
<ui-badge variant="warning">Pending review</ui-badge>Unread count
Add a concise count to a labelled inbox link without replacing its accessible name.
1 2 3 4
<a href="/inbox" class="inline-flex items-center gap-2">
<span>Inbox</span>
<ui-badge variant="info" ariaLabel="12 unread messages">12</ui-badge>
</a>API Reference
Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.
Inputs
variant 'default' 'default' | 'success' | 'warning' | 'danger' | 'info' Semantic color treatment.
size 'md' 'sm' | 'md' Badge padding and text size.
ariaRole '' string Optional ARIA role, such as status.
ariaLabel '' string Accessible label for compact or icon-only badges.
| Name | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'success' | 'warning' | 'danger' | 'info' | 'default' | Semantic color treatment. |
size | 'sm' | 'md' | 'md' | Badge padding and text size. |
ariaRole | string | '' | Optional ARIA role, such as status. |
ariaLabel | string | '' | Accessible label for compact or icon-only badges. |
Accessibility
- Use ariaRole="status" only when the badge announces dynamic status changes.
- Supplying ariaLabel without ariaRole promotes the badge to a named group so the label is exposed reliably.
Keyboard behavior
- Badge is non-interactive and should not receive focus.
Testing guidance
- Assert all semantic variants, sizes, truncation, and optional aria-label/role.
- No component harness is included because Badge is a non-interactive display primitive with directly observable DOM.