Skip to content

Stats card

A few figures that answer a question — revenue, orders, conversion — each with its change, coloured by which way is good, and a sparkline.

On this page
Open
The stats card, as tiles, in an aparté chat The stats card, as tiles, in an aparté chat

The figures a reporting tool returns, written in the chat’s language: sums in their currency, percentages, compact counts, durations. A change says which way it went; good says which way is good, so a rise in returns reads red and a rise in revenue green, and a screen reader hears which. Without good, a change stays neutral.

Open

A fact sheet, one row per figure.

Open

hero draws the first figure large over a wide chart, and the others beneath it.

Open
bash
npm install @aparte/plugin-cards @aparte/core
ts
import { setupStatsCard } from '@aparte/plugin-cards/stats';

setupStatsCard({
  tool: 'get_sales_summary',
  map: (result) => ({
    title: 'Sales this week',
    items: [
      { label: 'Revenue', value: result.revenue, currency: 'EUR', change: result.revenueChange, good: 'up', trend: result.daily },
      { label: 'Returns', value: result.returns, change: result.returnsChange, good: 'down' },
    ],
  }),
});

A change up to 1 is a ratio (0.12 reads +12 %). Formats, units and icons are in the guide.

  • Charts — when the answer is a chart rather than a few figures.
  • Stock card — a price and its chart.