Skip to main content

Stat Trend

A compact stat card with embedded sparkline chart for visualizing trends over time. Includes optional trend indicator with direction.

Installation

$ npx shadcn@latest add @orecus/stat-trend
Dependencies:
lucide-reactmotion
Registry:
skeleton@orecus/sparkline@orecus/color-utils@orecus/card@orecus/use-reduced-motion

Component

Line sparkline variants with trend indicators.

Revenue
+12.5%
Active Users
+23.1%
Orders Today
-3.2%
Rating
Revenue vs Costs
+12.5%
Revenue
Costs
Traffic Sources
Organic
Paid
Social

Props

PropTypeDefaultDescription
value*string | numberMain value to display
label*stringLabel for the stat
data*number[] | SparklineSeries[]Sparkline data points (single array or multi-series objects with name, data, and optional color)
trend{ value: string; direction: 'up' | 'down' | 'neutral'; color?: ThemeColor }Optional trend indicator
colorThemeColor'primary'Sparkline color
showFillbooleantrueShow area fill under sparkline
sparklineWidthnumber150Width of the sparkline in pixels
sparklineHeightnumber48Height of the sparkline in pixels
sparklineType'line' | 'area' | 'bar'Sparkline type (line, area, or bar)
curvedbooleanfalseWhether to use smooth curves
animatedbooleantrueWhether to animate the sparkline on mount
animateTextbooleantrueWhether to animate text elements (label, value, trend)
showLegendbooleanfalseShow legend below sparkline for multi-series data
loadingbooleanfalseShows skeleton loading state
cardPropsCardPropsProps to pass to the Card wrapper
classNamestringAdditional CSS classes