bx

Badge

Displays a badge or a component that looks like a badge.

DefaultSecondaryDestructiveOutline
tsx
<Badge>Default</Badge>
<Badge variant="secondary">Secondary</Badge>

Badge is a compact label for a status, a tag or a count. Four shadcn variants: default (primary), secondary, destructive, outline.

Installation

Terminal
$ bext ui add badge

Usage

tsx
import { Badge } from "@bext-stack/ui/primitives"

<Badge>Default</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>

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">.

Try it live Open in play

Edit this example live in the bext playground. It compiles and runs entirely in your browser.

src/app/page.tsx 1 file · react · runs in your browser
The React idiom: same UI, for comparison.