shadimage
avertra-ui
uibadgesource: ok · hit

Badge

A badge component for displaying status or labels.

npx shadcn add "https://micomponents.micustomer.io/r/badge.json"
free

Where it goes

stats

Interaction

animated-counter

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Files1 · source cached 10/9/2026, 10:04:38 AM

src/components/ui/badge.tsx
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/stories/lib/utils";

const badgeVariants = cva(
  "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium transition-colors cursor-default select-none",
  {
    variants: {
      variant: {
        subtle: "bg-accent1 text-accent1-foreground ",
        success: "bg-success text-black ",
        secondary: "bg-primary text-primary-foreground ",
        warning: "bg-warning text-warning-foreground ",
        important: "bg-error   text-error-foreground   ",
        black: "bg-black text-white  ",
        white: "bg-white text-black  ",
      },
    },
    defaultVariants: {
      variant: "subtle",
    },
  },
);

export interface BadgeProps
  extends
    React.HTMLAttributes<HTMLDivElement>,
    VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, ...props }: BadgeProps) {
  return (
    <div className={cn(badgeVariants({ variant }), className)} {...props} />
  );
}

export { Badge, badgeVariants };

More from avertra-ui

Browse all components in this library →