Skip to content
العربية
Charts

Sparkline

A small line without axes for KPI cards. It is hidden from screen readers unless you give it a title.

import { Sparkline } from "@percentsa/ui";

Examples

Orders this week

1,284

Code
export function SparklineExample() {
  const t = useT();
  return (
    <div className="grid w-full max-w-xs gap-3 rounded-card border border-line bg-surface p-5">
      <p className="text-sm text-fg-2">{t("Orders this week", "طلبات هذا الأسبوع")}</p>
      <p className="text-3xl font-semibold tabular-nums">{formatNumber(1284, useLang())}</p>
      <Sparkline values={[140, 162, 151, 180, 176, 210, 265]} title={t("Orders per day, last 7 days", "الطلبات اليومية في آخر 7 أيام")} className="text-fg" />
    </div>
  );
}