Fact Grid

View as Markdown

A few numbers about one thing, such as a customer's plan and seats, as small tiles.

Plan
BusinessAnnual, renews 1 March
Seats
48 of 502 left
Lifetime value
$148,200
Open tickets
31 breached SLA
CSAT
94%+3 pts this quarter
Customer since
Aug 2021

When to use

A few numbers about one thing, such as a customer's plan and seats, as small tiles. Use Stat instead when the numbers are a dashboard's headline, with trends.

Usage

import { FactGrid } from "./ui/uicontext/components/FactGrid.ts"
export const Account = <M>(h: Html.H<M>) =>	FactGrid(h, { label: "Account", facts: [{ label: "Plan", value: "Business" }, { label: "Seats", value: "48 of 50", tone: "warning" }] })

Examples

Plain, inside a card

variant: "plain" drops the tile borders; columns caps how many fit in a row.

Support triage agent · December

Runs
12,408+18% vs Nov
Success rate
97.2%
Median time
4.1s
Cost
$318.40Budget $500

API reference

Options

FactGrid options
NameTypeDefaultDescription
labelstring—What the facts are about: "Account", "This agent".
factsrequiredFact<Message>[]—The tiles, in order.
columnsnumber3The most tiles in a row; 3 by default.
minWidthnumber120A tile's narrowest width, in px, before the row wraps; 120 by default.
variant"tiles" | "plain"—tiles (the default) on a bordered surface, or plain with no border, for inside a card.
size"md" | "lg"—A larger value, for the facts at the top of a page.
styleStyle——

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/fact-grid

Source