Badge
A short status or label. Six tones, three variants, and an optional status dot.
Status: stable. Category: Data display.
import { Badge } from '@glyphui/ui'
Exports: Badge, badgeStyles.
Notes
- Tinted text is mixed toward the foreground color so it stays readable in light and dark mode.
- Color alone should not carry meaning; keep the label text descriptive.
Badge props
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | ||
dot | boolean | Leading status dot in the badge's color. | |
tone | "neutral" | "primary" | "info" | "success" | "warning" | "danger" | ||
variant | "soft" | "outline" | "solid" |
Example: Tones
import { Badge } from '@glyphui/ui'
export default function Example() {
return (
<div className="flex flex-wrap gap-2">
<Badge>Neutral</Badge>
<Badge tone="primary">Primary</Badge>
<Badge tone="info">Info</Badge>
<Badge tone="success">Success</Badge>
<Badge tone="warning">Warning</Badge>
<Badge tone="danger">Danger</Badge>
</div>
)
}
Example: Variants
Soft is the default; solid for emphasis, outline for quiet labels.
import { Badge } from '@glyphui/ui'
export default function Example() {
return (
<div className="grid gap-3">
<div className="flex flex-wrap gap-2">
<Badge tone="primary" variant="soft">
Soft
</Badge>
<Badge tone="primary" variant="solid">
Solid
</Badge>
<Badge tone="primary" variant="outline">
Outline
</Badge>
</div>
<div className="flex flex-wrap gap-2">
<Badge tone="danger" variant="soft">
Overdue
</Badge>
<Badge tone="danger" variant="solid">
Overdue
</Badge>
<Badge tone="danger" variant="outline">
Overdue
</Badge>
</div>
</div>
)
}
Example: Status with dot
import { Badge } from '@glyphui/ui'
export default function Example() {
return (
<div className="flex flex-wrap gap-2">
<Badge dot>Backlog</Badge>
<Badge tone="warning" dot>
In progress
</Badge>
<Badge tone="info" dot>
In review
</Badge>
<Badge tone="success" dot>
Deployed
</Badge>
</div>
)
}
Live page: https://glyphui.xyz/components/badge