Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Badge

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

BadgeSecondaryOutlineDestructive

Installation

npx logic2b@next add badge

Usage

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

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>

API reference

Generated from the public TypeScript exports in src/ui/badge.tsx.

View JSON

Badge

Component
Props: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }
PropTypeRequiredDefaultDescription
variantnull | "default" | "destructive" | "secondary" | "outline"No——
asChildbooleanNofalse—

badgeVariants

Utility
(props?: (ConfigVariants<{ variant: { default: string; secondary: string; destructive: string; outline: string; }; }> & ClassProp) | undefined): string

Accessibility contract

Machine-readable behavior and consumer responsibilities for badge.

View JSON
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.