Klar

Charts / React basic charts / Micro-charts

KPI card

A big figure with a delta chip that knows whether a rise is good or bad, the comparison period, and a sparkline, mini bars or progress to target, in four layouts.

React component KpiCard, data through props. Small charts that sit under a number in a KPI strip. Tags: kpi, stat, metric, scorecard, sparkline, delta, big number, tile.

Install

npm i klar-charts

import 'klar-charts/styles.css'
import { ThemeScope, KpiCard } from 'klar-charts'

# or copy the source:
npx shadcn@latest add https://klar.run/r/basic-kpi-card.json

Usage

<KpiCard
  label="Net revenue"
  icon={<CircleDollarSign size={14} />}
  value={1_284_300}
  previous={1_187_000}
  comparison="vs October"
  series={revenueDaily}
  seriesLabels={revenueDays.map(d)}
  variant={compact ? 'compact' : 'spark'}
  currency="USD"
  format={(x) => usd2.format(x)}
  seriesFormat={(x) => en.currency(x)}
/>

Related kpi card charts