BadgeSecondaryOutlineDestructive
Installation
npx logic2b@next add badgeUsage
import { Badge } from "@/components/ui/badge"
<Badge variant="outline">Badge</Badge>
Use asChild to render a link that looks like a badge.
Examples
With icon
A leading svg icon is sized and spaced automatically.
Verified3 newOverdue
As a link
Use asChild to render an anchor that looks like a badge.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Badge
variant="default"
>Status</Badge>Status
API reference
Generated from the public TypeScript exports in src/ui/badge.tsx.
Badge
ComponentProps: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | null | "default" | "destructive" | "secondary" | "outline" | No | — | — |
asChild | boolean | No | false | — |
badgeVariants
Utility(props?: (ConfigVariants<{ variant: { default: string; secondary: string; destructive: string; outline: string; }; }> & ClassProp) | undefined): stringAccessibility contract
Machine-readable behavior and consumer responsibilities for badge.
- Support
- Composition contract
- Pattern
- status text
- HTML span
Built-in semantics
- Does not add a live-region role; its text remains available in the normal reading order.
Consumer responsibilities
- Do not communicate state by color alone; add role=status only when dynamically updated status must be announced.