easeui
componentbadgesource: ok · hit
Badge
Small status pill in five colors, with a crossfade for when its variant changes.
npx shadcn add "https://easeui.dev/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.
Dependencies
Bundle weight · lightclsxtailwind-merge
Files2 · source cached 10/9/2026, 12:42:34 PM
components/motion/badge.tsx
// easeui.dev/components/motion/badge
import type { HTMLAttributes } from "react";
import { cn } from "@/lib/utils";
export type BadgeVariant = "neutral" | "accent" | "success" | "warning" | "destructive";
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
/** Color treatment. Default "neutral". */
variant?: BadgeVariant;
}
const VARIANT_CLASS: Record<BadgeVariant, string> = {
neutral: "bg-muted text-muted-foreground shadow-[0_0_0_1px_var(--border)]",
accent: "bg-accent/15 text-accent",
success: "bg-success/15 text-success",
warning: "bg-warning/15 text-warning",
destructive: "bg-destructive/15 text-destructive",
};
/** A small status pill. Crossfades color when its variant changes, such as pending to success. */
export function Badge({ variant = "neutral", className, ...props }: BadgeProps) {
return (
<span
className={cn(
"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium transition-colors duration-150 ease-out",
VARIANT_CLASS[variant],
className,
)}
{...props}
/>
);
}
lib/utils.ts
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}