Metric Card

PreviousNext

Animated metric card with counted numbers, sparkline, trend indicator, and Inset Card UI pattern.

Monthly Revenue
$0
+12%vs last month
Trend sparkline chart
Active Users
0
+24%
Trend sparkline chart
Conversion Rate
0.0%
-2%vs last week
Trend sparkline chart

Installation

pnpm dlx shadcn@latest add https://matos-ui.com/r/metric-card.json

Usage

import { MetricCard } from '@/components/matos-ui/metric-card'
<MetricCard
  label="Monthly Revenue"
  value={42850}
  prefix="R$ "
  trend={{ value: 12, label: 'vs previous month' }}
  sparkline={[2400, 1398, 3200, 2780, 3490, 4000, 4200]}
  footer={<span className="text-xs text-muted-foreground">Updated now</span>}
/>

Reference

MetricCard Props

PropTypeDefaultDescription
labelstring—Label shown in the card header.
valuenumber—Main numeric value (animated).
prefixstring?—Value prefix (e.g., R$).
suffixstring?—Value suffix (e.g., %).
decimalsnumber0Decimal places.
trend{ value, label? }?—Trend badge (positive/negative).
sparklinenumber[]?—Data for the sparkline chart.
footerReactNode?—Footer content.
size"sm" | "md" | "lg""md"Maximum card width.

Exported subcomponents

ComponentDescription
AnimatedNumberNumber with a spring counting animation.
TrendBadgeColored badge with arrow and percentage.
SparklineSVG chart with a smooth line, area, and end-point marker.

Also exported: metricCardVariants and the MetricCardProps type.