Badge
Displays a badge or a component that looks like a badge.
DefaultSecondaryDestructiveOutline
Badge is a compact label for a status, a tag or a count. Four shadcn variants: default (primary), secondary, destructive, outline.
Installation
$ bext ui add badge
Copy and paste the following into src/components/ui/badge.tsx.
Usage
Anatomy
<Badge variant="default|secondary|destructive|outline">Label</Badge>
API Reference
Badge
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "secondary" | "destructive" | "outline" | "default" | Style. default=bg-primary, secondary=bg-secondary, destructive=bg-destructive, outline=border only. |
| className | string | — | Additional Tailwind utilities. |
Accessibility
Purely decorative, with no ARIA role. If the badge carries important information that is not repeated in the text (e.g. "New"), add a <span class="sr-only">.
Edit this example live in the bext playground. It compiles and runs entirely in your browser.
The React idiom: same UI, for comparison.
On This Page