Stat Card

A statistics card that displays a titled metric value with an optional trend change indicator (up, down, or neutral), an optional icon badge, and an optional labeled progress bar. It is built on the boldkit Card component with a neo-brutalist style and supports seven color schemes.

Stat Card
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @boldkit/stat-card

Requires @boldkit in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { StatCard } from '@/components/ui/stat-card'export function Example() {  return (    <StatCard      title="Revenue"      value="$12,400"      change="+12.5%"      trend="up"    />  )}
  • Showing a headline KPI such as revenue, users, or conversion rate with a period-over-period change
  • Dashboards where each metric needs a directional trend indicator and an icon
  • Displaying goal completion or quota progress alongside a metric
  • Highlighting a key metric in a wider grid cell using the large variant

Examples

Trend with icon and comparison

A success-colored KPI card with an icon and a custom comparison label.

trend-with-icon-and-comparison.tsx
import { Users } from 'lucide-react'import { StatCard } from '@/components/ui/stat-card'export function ActiveUsersCard() {  return (    <StatCard      title="Active users"      value="8,320"      change="+4.2%"      trend="up"      comparison="vs last week"      colorScheme="success"      icon={<Users className="h-6 w-6" />}    />  )}

Metric with progress bar

A card showing a numeric value and goal completion with a custom progress label.

metric-with-progress-bar.tsx
import { Target } from 'lucide-react'import { StatCard } from '@/components/ui/stat-card'export function GoalCard() {  return (    <StatCard      title="Quarterly goal"      value="$84k"      trend="neutral"      colorScheme="info"      icon={<Target className="h-6 w-6" />}      progress={{ value: 72, label: 'Goal completion' }}    />  )}

Large destructive variant in a grid

A wide card spanning two columns on medium screens, signaling a negative trend.

large-destructive-variant-in-a-grid.tsx
import { AlertTriangle } from 'lucide-react'import { StatCard } from '@/components/ui/stat-card'export function ChurnCard() {  return (    <div className="grid gap-4 md:grid-cols-3">      <StatCard        variant="large"        title="Churn rate"        value="3.8%"        change="-0.6%"        trend="down"        colorScheme="destructive"        icon={<AlertTriangle className="h-6 w-6" />}      />    </div>  )}

API reference

PropTypeDefaultDescription
titlestring—Metric label rendered in uppercase above the value. Required.
valuestring | number—Main metric value rendered in large type. Required.
changestring—Change text shown in the trend row. The trend row is only rendered when provided.
trend'up' | 'down' | 'neutral''neutral'Selects the trend icon and color: up uses TrendingUp with text-success, down uses TrendingDown with text-destructive, neutral uses Minus with muted text.
iconReact.ReactNode—Icon node rendered inside a bordered square badge at the top right. The badge is only rendered when provided.
progress{ value: number; label?: string }—Shows a progress section with a label (defaults to 'Progress'), the percentage value, and a Progress bar. Hidden when omitted.
comparisonstring'vs last month'Muted text displayed after the change value.
variant'default' | 'compact' | 'large''default'Layout variant. compact reduces content padding to p-4; large spans two columns from the md breakpoint.
colorScheme'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'info' | 'destructive''primary'Color applied to the icon badge and decorative background element.
color'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'info' | 'destructive'—Deprecated alias for colorScheme. Used only when colorScheme is not set. Prefer colorScheme.
classNamestring—Additional classes merged onto the root Card via cn().
refReact.Ref<HTMLDivElement>—Forwarded to the root Card element.

Accessibility

  • The title and value are plain text paragraphs, so screen readers read them in document order; wrap the component in a list or section with a heading when grouping multiple cards.
  • The trend icon is decorative and has no accessible text; the change and comparison text carry the meaning, so include a clear sign in change (for example '+12.5%') rather than relying on color alone.
  • The icon is rendered without an aria-label by the component; if the icon conveys information beyond the title, pass an icon with aria-hidden or provide the information in the title or change text.
  • The progress percentage is shown as text next to the Progress bar; the underlying Progress component supplies its own semantics, so ensure its label is meaningful via the label prop.
  • Colors are applied to decorative elements and the icon badge; text contrast of the trend color depends on theme tokens such as text-success and text-destructive, so verify contrast in both light and dark themes.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Stat Card" component (boldkit/stat-card) from its shadcn registry.1. Install it with: npx shadcn@latest add @boldkit/stat-card2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: title, value, change, trend, icon, progress, comparison, variant, colorScheme, color, className, ref.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { StatCard } from '@/components/ui/stat-card'export function Example() {  return (    <StatCard      title="Revenue"      value="$12,400"      change="+12.5%"      trend="up"    />  )}```

Files & dependencies

  • registry/default/ui/stat-card.tsx→ components/ui/stat-card.tsx
dependenciesclass-variance-authoritylucide-react
registryDependencies@boldkit/utils@boldkit/card@boldkit/progress

Looks similar, elsewhere