shadcn-ui-blocks
blockapplication-application-stats-with-badgessource: ok · hit
With Badges
Stat cards pairing each number with a small badge that shows change or trend. Use to flag growth or decline next to revenue and signup totals.
npx shadcn add "https://www.shadcn-ui-blocks.com/r/application-application-stats-with-badges.json"free
Where it goes
statssignup
Interaction
animated-counter
Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.
Dependencies
Bundle weight · lighticonslucide-react
Files3 · source cached 10/9/2026, 10:04:34 AM
components/blocks/application/application-stats/with-badges.tsx
import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import {
ArrowDown,
ArrowUp,
Users,
DollarSign,
ShoppingCart,
Activity,
} from "lucide-react";
export default function WithBadges() {
return (
<div className="container mx-auto px-4 py-10 md:px-6 2xl:max-w-[1400px]">
<div className="grid gap-4 sm:grid-cols-2 sm:gap-6 lg:grid-cols-4">
{/* Card */}
<Card className="pt-0">
<CardContent className="pt-6">
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<Badge variant="outline" className="text-primary">
<Users className="mr-1 h-3 w-3" />
Users
</Badge>
<span className="flex items-center gap-0.5 text-green-700 dark:text-green-400">
<ArrowUp className="h-3 w-3" />
<span className="text-xs">12%</span>
</span>
</div>
<div>
<h3 className="text-2xl font-semibold">2,340</h3>
<p className="text-muted-foreground mt-1 text-xs">
Active users
</p>
</div>
</div>
</CardContent>
</Card>
{/* Card */}
<Card className="pt-0">
<CardContent className="pt-6">
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<Badge variant="outline" className="text-primary">
<DollarSign className="mr-1 h-3 w-3" />
Revenue
</Badge>
<span className="flex items-center gap-0.5 text-green-700 dark:text-green-400">
<ArrowUp className="h-3 w-3" />
<span className="text-xs">8.5%</span>
</span>
</div>
<div>
<h3 className="text-2xl font-semibold">$12,430</h3>
<p className="text-muted-foreground mt-1 text-xs">
Monthly revenue
</p>
</div>
</div>
</CardContent>
</Card>
{/* Card */}
<Card className="pt-0">
<CardContent className="pt-6">
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<Badge variant="outline" className="text-primary">
<ShoppingCart className="mr-1 h-3 w-3" />
Sales
</Badge>
<span className="flex items-center gap-0.5 text-red-700 dark:text-red-400">
<ArrowDown className="h-3 w-3" />
<span className="text-xs">4.2%</span>
</span>
</div>
<div>
<h3 className="text-2xl font-semibold">1,240</h3>
<p className="text-muted-foreground mt-1 text-xs">
Weekly sales
</p>
</div>
</div>
</CardContent>
</Card>
{/* Card */}
<Card className="pt-0">
<CardContent className="pt-6">
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<Badge variant="outline" className="text-primary">
<Activity className="mr-1 h-3 w-3" />
Conversion
</Badge>
<span className="flex items-center gap-0.5 text-green-700 dark:text-green-400">
<ArrowUp className="h-3 w-3" />
<span className="text-xs">2.4%</span>
</span>
</div>
<div>
<h3 className="text-2xl font-semibold">24.5%</h3>
<p className="text-muted-foreground mt-1 text-xs">
Conversion rate
</p>
</div>
</div>
</CardContent>
</Card>
</div>
</div>
);
}
components/ui/card.tsx
import * as React from "react"
import { cn } from "@/lib/utils"
function Card({
className,
size = "default",
...props
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
return (
<div
data-slot="card"
data-size={size}
className={cn(
"group/card flex flex-col gap-6 overflow-hidden rounded-xl bg-card py-6 text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
className
)}
{...props}
/>
)
}
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-header"
className={cn(
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-6 group-data-[size=sm]/card:px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-6 group-data-[size=sm]/card:[.border-b]:pb-4",
className
)}
{...props}
/>
)
}
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-title"
className={cn(
"font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",
className
)}
{...props}
/>
)
}
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-description"
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
)
}
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-action"
className={cn(
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
className
)}
{...props}
/>
)
}
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-content"
className={cn("px-6 group-data-[size=sm]/card:px-4", className)}
{...props}
/>
)
}
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-footer"
className={cn(
"flex items-center rounded-b-xl px-6 group-data-[size=sm]/card:px-4 [.border-t]:pt-6 group-data-[size=sm]/card:[.border-t]:pt-4",
className
)}
{...props}
/>
)
}
export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardAction,
CardDescription,
CardContent,
}
components/ui/badge.tsx
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Slot } from "radix-ui"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
secondary:
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
destructive:
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
outline:
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
ghost:
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
link: "text-primary underline-offset-4 hover:underline",
},
},
defaultVariants: {
variant: "default",
},
}
)
function Badge({
className,
variant = "default",
asChild = false,
...props
}: React.ComponentProps<"span"> &
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
const Comp = asChild ? Slot.Root : "span"
return (
<Comp
data-slot="badge"
data-variant={variant}
className={cn(badgeVariants({ variant }), className)}
{...props}
/>
)
}
export { Badge, badgeVariants }