RecordSummary
The 1 to 6 key facts of a record in one dense strip, for example under its header: a label, a value and an optional hint per cell. Cells follow the width of the strip itself (a container query, not the screen): one row from 56rem, 3 per row from 36rem (all when there are 4 or fewer), 2 per row below. media sits at the start (a Thumbnail), above the cells on narrow strips. An empty value shows “Not set”, long text is cut at 2 lines with the full text in the title, href makes the value a link, and loading shows a skeleton in each cell. label names the strip (default “Summary”). More than 6 items is a warning in development. In a report, the strip shows the totals of a period (sales, returns, VAT, net) above the table. An item with status shows a dot and a word at value size. An item with wrap shows its whole value, not cut at 2 lines, for a state sentence that a person must read on a phone.
import { RecordSummary, type RecordSummaryItem } from "@percentsa/ui";Examples
- Total
- 1,150
- Paid
- 500
- Balance
- 650
- Due 3 Mar
- Customer
- Al Rayan Trading Est.
- Branch
- Not set
- Note
- Deliver to the side entrance of the warehouse before noon
Code
export function RecordSummaryExample() {
const t = useT();
return (
<RecordSummary
className="w-full"
items={[
{ id: "total", label: t("Total", "الإجمالي"), value: <Money amount={1150} /> },
{ id: "paid", label: t("Paid", "المدفوع"), value: <Money amount={500} /> },
{ id: "due", label: t("Balance", "المتبقي"), value: <Money amount={650} />, hint: t("Due 3 Mar", "الاستحقاق 3 مارس") },
{ id: "customer", label: t("Customer", "العميل"), value: t("Al Rayan Trading Est.", "مؤسسة الريان للتجارة"), href: "#customer" },
{ id: "branch", label: t("Branch", "الفرع"), value: null },
{ id: "note", label: t("Note", "ملاحظة"), value: t("Deliver to the side entrance of the warehouse before noon", "التسليم عند المدخل الجانبي للمستودع قبل الظهر") },
]}
/>
);
}
/** A report: the totals of a period (a month), with a link on the largest figure. */- Available
- 12
- Price incl. VAT
- 230
- Before VAT: 200.00
- Category
- Brake pads
- Total
- Loading
- Paid
- Loading
- Balance
- Loading
Code
export function RecordSummaryMediaExample() {
const t = useT();
return (
<Stack gap={4} className="w-full">
<RecordSummary
className="w-full"
media={<Thumbnail alt={t("Brake pad set", "طقم فحمات")} size="lg" />}
items={[
{ id: "stock", label: t("Available", "المتوفر"), value: "12" },
{ id: "price", label: t("Price incl. VAT", "السعر شامل الضريبة"), value: <Money amount={230} />, hint: t("Before VAT: 200.00", "قبل الضريبة: 200.00") },
{ id: "category", label: t("Category", "التصنيف"), value: t("Brake pads", "فحمات الفرامل") },
]}
/>
<RecordSummary className="w-full" loading items={[{ id: "a", label: t("Total", "الإجمالي"), value: null }, { id: "b", label: t("Paid", "المدفوع"), value: null }, { id: "c", label: t("Balance", "المتبقي"), value: null }]} />
</Stack>
);
}- Returns
- 4,120.00
- 23 credit notes
- VAT collected
- 32,466.58
- Net
- 212,323.92
- Cash and cards
Code
export function RecordSummaryReportExample() {
const t = useT();
return (
<RecordSummary
className="w-full"
label={t("Totals of September 2026", "إجماليات سبتمبر 2026")}
items={[
{ id: "sales", label: t("Sales", "المبيعات"), value: <Money amount={248910.5} decimals={2} />, hint: t("1,284 invoices", "1,284 فاتورة"), href: "#sales" },
{ id: "returns", label: t("Returns", "المرتجعات"), value: <Money amount={4120} decimals={2} />, hint: t("23 credit notes", "23 إشعار دائن") },
{ id: "vat", label: t("VAT collected", "الضريبة المحصلة"), value: <Money amount={32466.58} decimals={2} /> },
{ id: "net", label: t("Net", "الصافي"), value: <Money amount={212323.92} decimals={2} />, hint: t("Cash and cards", "نقدًا وبطاقات") },
]}
/>
);
}- Production now
- Live
- Backup
- Down
- Since 09:40
Code
export function RecordSummaryStatusExample() {
const t = useT();
return (
<RecordSummary
className="w-full"
items={[
{ id: "production", label: t("Production now", "الإنتاج الآن"), status: { tone: "live", label: t("Live", "يعمل") } },
{ id: "backup", label: t("Backup", "النسخ الاحتياطي"), status: { tone: "danger", label: t("Down", "متوقف") }, hint: t("Since 09:40", "منذ 09:40") },
]}
/>
);
}
/** A long state sentence shown whole. */- State
- Closed
- Next
- Stays closed until the review ends
- Branch
- Riyadh
- Customer
- Al Noor
Code
export function RecordSummaryWrapExample() {
const t = useT();
return (
<RecordSummary
className="w-full max-w-sm"
items={[
{ id: "state", label: t("State", "الحالة"), status: { tone: "danger", label: t("Closed", "مغلق") } },
{ id: "next", label: t("Next", "التالي"), value: t("Stays closed until the review ends", "يبقى مغلقًا حتى تنتهي المراجعة"), wrap: true },
{ id: "branch", label: t("Branch", "الفرع"), value: t("Riyadh", "الرياض") },
{ id: "customer", label: t("Customer", "العميل"), value: t("Al Noor", "النور") },
]}
/>
);
}