Componentdata2.24 KB gzipZero dependencies
Metric Card
Dashboard KPI card with value, trend delta and period label.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add metric-cardOr install the full npm package:
npm install bigbulluiUsage
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 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| title | string | Metric title or KPI description (required). |
| value | string | number | Primary large KPI metric value (required). |
| prefix | React.ReactNode | Prefix symbol displayed before value (e.g. '$'). |
| suffix | React.ReactNode | Suffix unit displayed after value (e.g. '/mo', 'ms'). |
| trend | MetricCardTrend | Trend object with value (+12.4%), direction ('up' | 'down' | 'neutral'), label, and invertColors. |
| periodLabel | string | Period comparison label (e.g. 'ROLLING 30 DAYS'). |
| badge | string | Eyebrow status badge text (default 'LIVE AUDIT'). |
| serial | string | Ticket stub serial number label (e.g. 'STUB // KPI-01'). |
| sparklineData | number[] | Array of numeric datapoints to render an inline SVG trend line. |
| sparklineTone | "accent" | "foreground" | "success" | "muted" | Color tone for sparkline stroke and fill. |
| progress | number | Progress bar percentage (0 to 100). |
| progressTarget | string | Target label displayed above progress bar. |
| statusDot | "active" | "warning" | "error" | "idle" | Status dot indicator in the header badge. |
| footerText | string | Bottom validation or source stamp text. |
| barcodeValue | string | Serial readout displayed next to mini SVG barcode. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |