An overview
Live nowLive1812 by phone · 6 on WhatsApp
Today214Up 8%vs yesterday
Success rate81%Up 3.2 ptsvs previous period
import { KpiGrid } from '@arbol-ai/ui';
import type { Kpi } from '@arbol-ai/ui';
const OVERVIEW: Kpi[] = [
{ id: 'live', label: 'Live now', value: 18, isLive: true, hint: '12 by phone · 6 on WhatsApp' },
{ id: 'today', label: 'Today', value: 214, change: 0.08, changeLabel: 'vs yesterday' },
{
id: 'rate',
label: 'Success rate',
value: 0.81,
formatOptions: { style: 'percent' },
change: 3.2,
changeUnit: 'points',
info: 'Conversations that reached their goal, out of every conversation with a result.',
},
{
id: 'review',
label: 'To review',
value: 23,
change: -0.12,
changeTone: 'inverse',
info: 'Conversations the agents handed to your team that nobody has closed yet.',
link: { href: '#/kpi-grid', label: 'Review them' },
},
];
<KpiGrid items={OVERVIEW} />One figure and its reading
A report about one figure reads it in a sentence beside it.
Average call3:45minUp 4%vs previous period
Calls lasted a little longer than the week before; a longer call is not a worse one.
import { KpiGrid } from '@arbol-ai/ui';
<KpiGrid
items={[
{
id: 'duration',
label: 'Average call',
value: '3:45',
unit: 'min',
change: 0.04,
changeTone: 'neutral',
},
]}
reading="Calls lasted a little longer than the week before; a longer call is not a worse one."
/>Loading, and a period still ahead
Placeholders hold each figure’s place; a period ahead has nothing to compare with.
Live now
Today
Success rate
Booked for next week312No previous period
import { KpiGrid } from '@arbol-ai/ui';
import type { Kpi } from '@arbol-ai/ui';
const OVERVIEW: Kpi[] = [
{ id: 'live', label: 'Live now', value: 18, isLive: true, hint: '12 by phone · 6 on WhatsApp' },
{ id: 'today', label: 'Today', value: 214, change: 0.08, changeLabel: 'vs yesterday' },
{
id: 'rate',
label: 'Success rate',
value: 0.81,
formatOptions: { style: 'percent' },
change: 3.2,
changeUnit: 'points',
info: 'Conversations that reached their goal, out of every conversation with a result.',
},
{
id: 'review',
label: 'To review',
value: 23,
change: -0.12,
changeTone: 'inverse',
info: 'Conversations the agents handed to your team that nobody has closed yet.',
link: { href: '#/kpi-grid', label: 'Review them' },
},
];
<div className="grid gap-4">
<KpiGrid isLoading items={OVERVIEW.slice(0, 3)} />
<KpiGrid items={[{ id: 'booked', label: 'Booked for next week', value: 312, change: null }]} />
</div>Source
The examples above are src/blocks/kpi-grid/kpi-grid.examples.tsx, which the library’s tests render too.