Skip to content
العربية
Data display

DescriptionList

Terms and their details, such as project facts. layout="columns" puts them side by side from 768 px of the screen. layout="auto" does it when the list itself is 28rem wide or more (a container query), so a list in a narrow cell stays stacked; the list must not take its width from its content. density="compact" makes the rows tighter (py-2 in place of py-3). cols={2} or cols={3} puts the pairs in columns, row by row (a container query on the list, so a list in a narrow card has fewer columns, down to one); the lines run across each row, and a last row with fewer pairs stretches them. layout still sets each pair: stack (term above details, columns of at least 8rem: short money rows such as a cash summary), columns (term beside details, columns of at least 18rem), auto (stacked, beside each other when each column is 28rem or more).

import { DescriptionList } from "@percentsa/ui";

Examples

Client
Masar
Services
Product design, mobile app, hosting
Start date
1 March 2026
Budget
240,000
Status
Live
Code
export function DescriptionListExample() {
  const t = useT();
  const lang = useLang();
  return (
    <DescriptionList
      className="w-full max-w-lg"
      layout="columns"
      items={[
        { term: t("Client", "العميل"), details: t("Masar", "مسار") },
        { term: t("Services", "الخدمات"), details: t("Product design, mobile app, hosting", "تصميم المنتج، تطبيق جوال، استضافة") },
        { term: t("Start date", "تاريخ البدء"), details: formatDate(new Date("2026-03-01T00:00:00+03:00"), { lang }) },
        { term: t("Budget", "الميزانية"), details: <Money amount={240000} /> },
        { term: t("Status", "الحالة"), details: <StatusDot status="live">{t("Live", "يعمل")}</StatusDot> },
      ]}
    />
  );
}
Client
Masar
Services
Product design, mobile app, hosting
Budget
240,000
Client
Masar
Services
Product design, mobile app, hosting
Budget
240,000
Code
export function DescriptionListAutoExample() {
  const t = useT();
  const items = [
    { term: t("Client", "العميل"), details: t("Masar", "مسار") },
    { term: t("Services", "الخدمات"), details: t("Product design, mobile app, hosting", "تصميم المنتج، تطبيق جوال، استضافة") },
    { term: t("Budget", "الميزانية"), details: <Money amount={240000} /> },
  ];
  return (
    <div className="grid w-full gap-6 sm:grid-cols-[16rem_1fr]">
      <DescriptionList layout="auto" density="compact" items={items} />
      <DescriptionList layout="auto" density="compact" items={items} />
    </div>
  );
}

Cash, 2 columns

Opening
500
Cash sales
9,120
Cash in
300
Cash out
150
Refunds
180
Expected
9,590
Counted
9,570
Difference
20

The same list in a narrow card

Opening
500
Cash sales
9,120
Cash in
300
Cash out
150

2 columns, term beside details

Opening
500
Cash sales
9,120
Cash in
300
Cash out
150
Refunds
180
Expected
9,590
Counted
9,570
Difference
20
Code
export function DescriptionListColsExample() {
  const t = useT();
  const row = (term: string, termAr: string, amount: number) => ({ term: t(term, termAr), details: <Money amount={amount} /> });
  const items = [
    row("Opening", "الافتتاحي", 500),
    row("Cash sales", "مبيعات نقدية", 9120),
    row("Cash in", "إيداع", 300),
    row("Cash out", "سحب", 150),
    row("Refunds", "المرتجعات", 180),
    row("Expected", "المتوقع", 9590),
    row("Counted", "المعدود", 9570),
    row("Difference", "الفرق", 20),
  ];
  return (
    <div className="grid w-full gap-6 sm:grid-cols-[1fr_16rem]">
      <Card title={t("Cash, 2 columns", "النقد، عمودان")} headingLevel={4} density="compact">
        <DescriptionList cols={2} density="compact" items={items} />
      </Card>
      <Card title={t("The same list in a narrow card", "القائمة نفسها في بطاقة ضيقة")} headingLevel={4} density="compact">
        <DescriptionList cols={2} density="compact" items={items.slice(0, 4)} />
      </Card>
      <Card title={t("2 columns, term beside details", "عمودان، المصطلح بجانب تفاصيله")} headingLevel={4} density="compact" className="sm:col-span-2">
        <DescriptionList cols={2} layout="columns" density="compact" items={items} />
      </Card>
    </div>
  );
}