Stat group
Several figures or states read at a glance, joined in one card or as one compact card each.
StatGroup draws a row of headline figures. Each cell has an icon well, a mono label, the value and a detail line, and may link to where the figure is managed. joined draws one card split by hairlines (a security status strip); cards draws one compact stat card per figure (a modules summary).
StatGroupUsage
import { StatGroup } from "@antelopejs/interface-dms/base/stat-group";
static status = StatGroup({
layout: "joined",
items: [
{ id: "mfa", icon: "i-ph-shield-check", tone: "success", eyebrow: "$app.security.mfa",
value: "$app.security.on", detail: "$app.security.authenticator", to: "/settings/user/security" },
{ id: "sessions", icon: "i-ph-devices", eyebrow: "$app.security.sessions", value: 3 },
],
});
From a route, answer { items } in the same shape:
static stats = StatGroup({ layout: "cards", fetchUrl: "/api/billing/stats" });
@Get("stats")
stats() {
return {
items: [
{ id: "sent", icon: "i-ph-receipt", eyebrow: "$billing.stats.sent", value: 1284 },
{ id: "overdue", icon: "i-ph-warning-octagon", tone: "error", eyebrow: "$billing.stats.overdue", value: 6,
detail: { key: "billing.stats.oldest", params: { days: { type: "count", value: 41 } } }, detailTone: "error" },
],
};
}
Options
| Option | Type | Default | Description |
|---|---|---|---|
empty.title* Content | string | – | |
empty.description Content | string | – | |
layout Appearance | "joined" | "cards" | "joined" | One card split in cells, or one card per cell. |
columns Layout | number | – | How many columns on a wide screen; by default, one per cell. |
The columns follow the group's own width, not the viewport: three cells sit side by side from a 36rem group, one per row below. columnsFrom moves that point for cells with short values, as a container size (sm 24rem, md 28rem, lg 32rem, xl 36rem): all columns from it, one column below (two as cards when the usual steps start at two). On the frontend, DmsStatGroup takes the same prop. In a 600px drawer, three short figures keep their row:
<DmsStatGroup layout="joined" :columns="3" columns-from="md" :items="stats" />
A cell (StatGroupItem) carries eyebrow and value, plus optional icon, tone (muted by default when joined, primary as cards), detail, detailTone and to. eyebrow, value and detail take a composed text. A number value is formatted for the locale.
Pitfalls
- A detail takes up to two lines before its ellipsis; the row takes the height of its tallest cell.
- Columns drop on narrow screens: a joined group goes to one column on phones, compact cards keep two.
- For one metric followed over a period, with its variation and sparkline, use a KPI card.
