Badge

A small label component for displaying status, categories, or metadata.

This is a standalone component that does not depend on the assistant-ui runtime. Use it anywhere in your application.

OutlineSecondaryMutedGhostInfoWarningSuccessDestructive

Installation

npx shadcn@latest add https://r.assistant-ui.com/badge.json

Usage

import { Badge } from "@/components/assistant-ui/badge";

export function Example() {
  return <Badge>Label</Badge>;
}

Examples

Variants

Use the variant prop to change the visual style.

OutlineSecondaryMutedGhostInfoWarningSuccessDestructive
<Badge variant="outline" />     // Border (default)
<Badge variant="secondary" />   // Secondary background
<Badge variant="muted" />       // Muted background
<Badge variant="ghost" />       // No background
<Badge variant="info" />        // Blue/info style
<Badge variant="warning" />     // Amber/warning style
<Badge variant="success" />     // Green/success style
<Badge variant="destructive" /> // Red/error style

Sizes

Use the size prop to change the badge size.

SmallLabel
DefaultLabel
LargeLabel
<Badge size="sm" />      // Small
<Badge size="default" /> // Default
<Badge size="lg" />      // Large

With Icons

Badges automatically style SVG icons.

SuccessFailedPending

Use the asChild prop to render the badge as a different element, like a link.

Animated

Combine with CSS transitions for scroll and color animations.

LoadingMission Success

API Reference

Badge

BadgeProps
variant: "outline" | "secondary" | "muted" | "ghost" | "info" | "warning" | "success" | "destructive"= "outline"

The visual style of the badge.

size: "sm" | "default" | "lg"= "default"

The size of the badge.

asChild: boolean= false

Merge props with child element instead of rendering a span.

className?: string

Additional CSS classes.

Style Variants (CVA)

ExportDescription
badgeVariantsStyles for the badge component.
import { badgeVariants } from "@/components/assistant-ui/badge";

<span className={badgeVariants({ variant: "muted", size: "sm" })}>
  Custom Badge
</span>