Skip to content
العربية
App patterns

RecordSection

A record's facts as text in a card, with its edit action in the header. Terms and details sit side by side from 768 px. Empty details show “Not set”, so a missing value never looks like a layout gap. The heading is an h2 (headingLevel={3} inside a section). layout="auto" puts them side by side when the section itself is 28rem wide or more (a container query), for a section in a narrow cell. density="compact" is for dense records.

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

Examples

Customer

Name
Sara Al-Qahtani
Email
Not set
City
Riyadh
Code
export function RecordSectionExample() {
  const t = useT();
  return (
    <RecordSection
      className="w-full max-w-2xl"
      title={t("Customer", "العميل")}
      action={<Button variant="secondary" size="sm">{t("Edit", "تعديل")}</Button>}
      items={[
        { term: t("Name", "الاسم"), details: t("Sara Al-Qahtani", "سارة القحطاني") },
        { term: t("Phone", "الجوال"), details: <PhoneText value="+966550000999" /> },
        { term: t("Email", "البريد الإلكتروني"), details: null },
        { term: t("City", "المدينة"), details: t("Riyadh", "الرياض") },
      ]}
    />
  );
}

Customer

Name
Sara Al-Qahtani
Email
Not set
City
Riyadh

Customer

Name
Sara Al-Qahtani
Email
Not set
City
Riyadh
Code
export function RecordSectionAutoExample() {
  const t = useT();
  const items = [
    { term: t("Name", "الاسم"), details: t("Sara Al-Qahtani", "سارة القحطاني") },
    { term: t("Email", "البريد الإلكتروني"), details: null },
    { term: t("City", "المدينة"), details: t("Riyadh", "الرياض") },
  ];
  return (
    <div className="grid w-full gap-4 md:grid-cols-[18rem_1fr]">
      <RecordSection layout="auto" density="compact" title={t("Customer", "العميل")} items={items} />
      <RecordSection layout="auto" density="compact" title={t("Customer", "العميل")} items={items} />
    </div>
  );
}

/** A log list: an "Errors only" toggle chip, a level menu, and search with suggestions. Enter runs the search. */