Badge
Small status indicator label
UI PrimitiveDisplay
Overview
A polymorphic badge component with six visual variants. Supports asChild to render as any element (e.g., a link).
Usage
import { Badge } from "@leanicon/web-builder-library";
<Badge>New</Badge>
<Badge variant="secondary">Beta</Badge>
<Badge variant="destructive">Error</Badge>Variants
Variant | Description |
|---|---|
| Primary background |
| Muted background |
| Destructive/error background |
| Border only, transparent background |
| No border or background, hover accent |
| Underline on hover (for anchor usage) |
DefaultSecondaryErrorDraftArchived
As a link:
<Badge asChild variant="outline">
<a href="/docs">Docs</a>
</Badge>Notes
asChildrenders the badge using Radix UI'sSlot.Root, forwarding all props to the child element.- SVG icons inside a badge are automatically sized to
12px. - Dark mode is handled via semantic tokens.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
variant | "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | default | No | |
asChild | boolean | false | No |