Skip to content

StatCard

Purpose

StatCard displays a single metric or KPI with:

  • Icon indicator
  • Numeric or text value
  • Descriptive label
  • Color variants for semantic meaning

When to use

Use StatCard for:

  • Dashboard KPIs
  • Summary metrics at the top of list pages
  • Quick status indicators

Basic usage

tsx
import { StatCard } from '@/shared/ui/components/StatCard'
import { Users, TrendingUp, AlertCircle } from 'lucide-react'

export function DashboardStats() {
  return (
    <div className="grid grid-cols-4 gap-4">
      <StatCard
        icon={<Users />}
        value="1,234"
        label="Total Users"
      />
      <StatCard
        icon={<TrendingUp />}
        value="+12%"
        label="Growth"
        variant="success"
      />
      <StatCard
        icon={<AlertCircle />}
        value="3"
        label="Issues"
        variant="warning"
      />
    </div>
  )
}

Props

PropTypeDefaultDescription
iconReactNode-Icon element (Lucide icon recommended)
valuestring | numberRequiredThe metric value
labelstringRequiredDescription of the metric
variant'default' | 'success' | 'warning' | 'danger' | 'info''default'Color theme
classNamestring-Additional CSS class

Variants

VariantUse case
defaultNeutral metrics
successPositive indicators (growth, completed)
warningAttention needed (pending, expiring)
dangerCritical issues (errors, overdue)
infoInformational metrics

Notes

  • Icons are automatically sized and colored based on variant
  • Built on the Card primitive for consistent styling
  • For animated counters with trends, see LiveCounter