Animated Badge
beui/animated-badgeFreeComponent
Status badge with animated state icons, pulse feedback and compact size variants.
Install it
npx shadcn@latest add https://beui.dev/r/animated-badge.jsonSource
1"use client";2// beui.dev/components/motion/animated-badge34import {5 AlertTriangle,6 Check,7 Circle,8 Info,9 LoaderCircle,10 X,11 type LucideIcon,12} from "lucide-react";13import {14 AnimatePresence,15 motion,16 useReducedMotion,17 type HTMLMotionProps,18 type Variants,19} from "motion/react";20import type { ReactNode } from "react";21import { EASE_OUT } from "@/lib/ease";22import { cn } from "@/lib/utils";2324export type AnimatedBadgeStatus =25 | "neutral"26 | "info"27 | "success"28 | "warning"29 | "danger"30 | "loading";3132export type AnimatedBadgeSize = "sm" | "md";3334export interface AnimatedBadgeProps extends Omit<35 HTMLMotionProps<"span">,36 "children"37> {38 status?: AnimatedBadgeStatus;39 size?: AnimatedBadgeSize;40 children?: ReactNode;41 icon?: ReactNode;42 showIcon?: boolean;43 pulse?: boolean;44 contentKey?: string | number;45}4647const STATUS_CLASS: Record<AnimatedBadgeStatus, string> = {48 neutral: "border-border bg-card text-muted-foreground",49 info: "border-primary/30 bg-primary/10 text-primary",50 success: "border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",51 warning: "border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",52 danger: "border-destructive/30 bg-destructive/10 text-destructive",53 loading: "border-primary/30 bg-primary/10 text-primary",54};5556const SIZE_CLASS: Record<AnimatedBadgeSize, string> = {57 sm: "h-6 gap-1.5 px-2 text-[11px]",58 md: "h-8 gap-2 px-3 text-xs",59};6061const ICON_CLASS: Record<AnimatedBadgeSize, string> = {62 sm: "h-3 w-3",63 md: "h-3.5 w-3.5",64};6566const ICONS: Record<AnimatedBadgeStatus, LucideIcon> = {67 neutral: Circle,68 info: Info,69 success: Check,70 warning: AlertTriangle,71 danger: X,72 loading: LoaderCircle,73};7475const ICON_ROLL_VARIANTS: Variants = {76 initial: {77 opacity: 0.72,78 y: "80%",79 scale: 0.92,80 rotate: -8,81 filter: "blur(6px)",82 },83 animate: {84 opacity: 1,85 y: "0%",86 scale: 1,87 rotate: 0,88 filter: "blur(0px)",89 transition: {90 y: { type: "spring", stiffness: 210, damping: 24, mass: 0.85 },91 scale: { type: "spring", stiffness: 250, damping: 24, mass: 0.75 },92 rotate: { duration: 0.28, ease: EASE_OUT },93 opacity: { duration: 0.28, ease: EASE_OUT },94 filter: { duration: 0.42, ease: EASE_OUT },95 },96 },97 exit: {98 opacity: 0.5,99 y: "-80%",100 scale: 0.96,101 rotate: 8,102 filter: "blur(6px)",103 transition: { duration: 0.22, ease: EASE_OUT },104 },105};106107// … truncated
What it pulls in
npm packages
Files it writes
More from beui
All 104 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Action Swap Bluraction-swap-blur | beui | Components | Free | 3 deps · 4 files | |
| Action Swap Cascadeaction-swap-cascade | beui | Components | Free | 3 deps · 4 files | |
| Action Swap Rollaction-swap-roll | beui | Components | Free | 3 deps · 4 files | |
| Agent Activityagent-activity | beui | Components | Free | 4 deps · 9 files | |
| Agent Loading States Agent Progressagent-progress | beui | Components | Free | 3 deps · 3 files | |
| AI Sidebarai-sidebar | beui | Components | Free | 4 deps · 5 files | |
| Number Animation Animated Numberanimated-number | beui | Components | Free | 3 deps · 3 files | |
| Animated Sidebaranimated-sidebar | beui | Components | Free | 4 deps · 4 files |
