KPI Card
A card for one key figure on a dashboard, with its change and an icon.Total revenue
$45,231.89Increased by 20.1%
from last monthJSX
<KpiCard label="Total revenue" value="$45,231.89" delta="20.1%" description="from last month" />
Installation
Package
CLI (copy source)
pnpm
pnpm add @advui/datanpm
npm install @advui/dataUsage
import { KpiCard } from '@advui/data'
import { CreditCardIcon } from '@advui/icons'
<KpiCard
label="Total revenue"
value="$45,231.89"
delta="20.1%"
trend="up"
description="from last month"
icon={<CreditCardIcon />}
/>Examples
Basic
Preview
Code
Total revenue
$45,231.89Increased by 20.1%
from last monthDashboard row
Fewer returns is good news: `tone="positive"` on a down trend.Preview
Code
Subscriptions
2,350Increased by 180.1%
from last monthOrders
12,234Decreased by 4.3%
from last monthReturns
312Decreased by 11%
fewer than last monthActive now
573No change: 0%
since last hourWith a progress bar
Preview
Code
Quarterly target
$182,400of $250,000
73% reached, 24 days left
Loading
Preview
Code
New customers
API reference
KpiCard
Also takes every Card prop (`variant`, `interactive`, `onPress`…).| Prop | Type | Default | Description |
|---|---|---|---|
label required | ReactNode | — | What is measured. |
value required | ReactNode | — | The figure, already formatted. |
delta | ReactNode | — | The change, e.g. `"12.5%"`. |
trend | 'up' | 'down' | 'neutral' | 'neutral' | Direction of the change; picks the arrow. |
tone | 'positive' | 'negative' | 'neutral' | from `trend` | Good or bad news; picks the color. Set it when a drop is good. |
trendLabel | string | from `trend` | Read by screen readers before the delta: 'Increased by', 'Decreased by' or 'No change:' for the `trend`. |
description | ReactNode | — | Short note after the delta. |
icon | ReactNode | — | Decorative icon in the top corner. |
loading | boolean | false | Placeholders for the value and delta; sets `aria-busy`. |
children | ReactNode | — | Extra content below the figure, such as a Progress bar. |
Accessibility
- The card reads as plain text in order: label, value, change, note. The icon is hidden.
- The change is read with its direction ("Increased by 20.1%"); set
trendLabelto translate it. - While
loading, the card hasaria-busyand the placeholders are hidden. - An interactive card (
interactive+onPress) needs aroleand anaria-label, as with Card.
Responsive behavior
Card padding shrinks from 24px to 16px below the sm breakpoint. Lay cards out with Grid.