Badge
A small label that marks nearby content with a status or category. Renders a span, or the render element, and forwards its ref.
ActivePendingExpiredDraft
'use client';
import { Badge } from '@clerk/mosaic/components/badge';
export default function BadgeExample() {
return (
<>
<Badge color='positive'>Active</Badge>
<Badge color='warning'>Pending</Badge>
<Badge color='negative'>Expired</Badge>
<Badge color='neutral'>Draft</Badge>
</>
);
}Use for
- a status label such as Active or Failed
- a category or role tag next to a name
- a "New" marker
Practices
| Guidance | Practice |
|---|---|
| Do | Pick color by meaning: positive for success, negative for failure, warning for attention. |
| Do | Pass render to make a badge a link, such as render={<a href="/billing" />}. |
| Don’t | Use a badge for a message the user must read. Use Banner instead. |
API reference
Badge
The label. color defaults from BadgeContext when a parent sets it.
Slot: cl-badge
| Prop | Type | Description |
|---|---|---|
color | 'primary' | 'neutral' | 'warning' | 'negative' | 'positive' | primary, neutral, warning, negative or positive.Default: 'primary' |
Examples
A status
<Badge color='positive'>Active</Badge>As a link
<Badge render={<a href='/billing' />}>Upgrade</Badge>