Metric Card with Sparkline

Pro

Dashboard cards with a hand-rolled monotone-cubic SVG line and a glowing dot that snaps to wherever you scrub.

heavy saas blocksmetricsparklinecardframer motiontabler icons react
Metric Card with Sparkline component preview

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add metric-sparkline-card

Usage

Import MetricSparklineCard from @/components/wensity/metric-sparkline-card and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
"use client";
import { MetricSparklineCard } from "@/components/wensity/metric-sparkline-card";
const revenueData = [24000, 24820, 25104, 24960, 26410, 27120, 28330];
export function MetricSparklineCardDemo() {
return (
<MetricSparklineCard
label="Revenue"
prefix="$"
values={revenueData}
formatValue={(n) => Math.round(n).toLocaleString()}
/>
);
}

Props

PropTypeDefaultDescription
labelstring-Metric label shown above the value.
valuesnumber[]-Raw series values. Length should be at least 2.
formatValue(n: number) => string-Pretty-print the primary value. If omitted, the last data point is shown.
prefixstring-Optional value prefix such as $.
suffixstring-Optional value suffix such as users.
widthnumber320SVG width in pixels.
heightnumber84SVG height in pixels.
deltaPercentnumber-Optional explicit delta percentage. When omitted, derived from first vs last.
strokestring-Stroke color CSS variable or hex. Defaults to chili-500.
datesstring[]-Optional dates corresponding to the values.
statusLabelstring-Optional default footer label when not hovering.