Componentdata2.24 KB gzipZero dependencies

Metric Card

Dashboard KPI card with value, trend delta and period label.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add metric-card

Or install the full npm package:

npm install bigbullui

Usage

tsx9 lines
import { MetricCard } from "@/components/ui/metric-card"; <MetricCard  title="MONTHLY RECURRING REVENUE"  value="$48,250"  trend={{ value: "+14.8%", label: "vs last month" }}  sparklineData={[32, 38, 35, 42, 40, 48, 52, 59, 64]}  badge="REALTIME"/>

Source code

metric-card.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxmetric-card.tsx376 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export type TrendDirection = "up" | "down" | "neutral"; export interface MetricCardTrend {  value: string | number;  direction?: TrendDirection;  label?: string;  invertColors?: boolean;} export type MetricCardProps = Omit<React.HTMLAttributes<HTMLDivElement>, "prefix"> & {  title: string;  value: string | number;  prefix?: React.ReactNode;

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { MetricCard } from "@/components/ui/metric-card"; <MetricCard />
PropTypeDescription
titlestringMetric title or KPI description (required).
valuestring | numberPrimary large KPI metric value (required).
prefixReact.ReactNodePrefix symbol displayed before value (e.g. '$').
suffixReact.ReactNodeSuffix unit displayed after value (e.g. '/mo', 'ms').
trendMetricCardTrendTrend object with value (+12.4%), direction ('up' | 'down' | 'neutral'), label, and invertColors.
periodLabelstringPeriod comparison label (e.g. 'ROLLING 30 DAYS').
badgestringEyebrow status badge text (default 'LIVE AUDIT').
serialstringTicket stub serial number label (e.g. 'STUB // KPI-01').
sparklineDatanumber[]Array of numeric datapoints to render an inline SVG trend line.
sparklineTone"accent" | "foreground" | "success" | "muted"Color tone for sparkline stroke and fill.
progressnumberProgress bar percentage (0 to 100).
progressTargetstringTarget label displayed above progress bar.
statusDot"active" | "warning" | "error" | "idle"Status dot indicator in the header badge.
footerTextstringBottom validation or source stamp text.
barcodeValuestringSerial readout displayed next to mini SVG barcode.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.