Skip to content

Patterns

Record detail

People open one record to decide something about it: accept or reject it, add a note, see who did what. They need its state at a glance, the actions in one place, and the page to show the new state the moment they act.

Reference build

Live, built only from system components. Switch the width: the build uses its own breakpoints.

Rules

  1. PageHead size="md" carries the record's name as title, its state in status (a Pill with the word) and at most two actions that change the state.
  2. After an action the page shows the new state where the old one was: the status changes, the action that no longer applies disappears, and the activity gets a new first entry. A destructive or irreversible action asks first (Destructive confirmation).
  3. Facts (who, when, how much) go in a DescriptionList next to the record's own content, in Columns aside-main.
  4. What the team adds (a note, an assignment) is a Form of its own with its own save button.
  5. Activity lists events newest first, each with its date; it records the actions taken on this page.
  6. Contact details or help that people consult while deciding go in AppShell's inspector, not in the main content.
  7. In the navigation the record belongs to its list: give the list's SideNav item a match for the detail path.

Layout and states

What every build of this pattern must hold to. The check runs the required states on the reference build.
Layout
Inside AppShell: PageHead, then regions with gap-region: Columns aside-main (facts, content), the team's Form, the activity. Optional inspector for contact details.
Small screens: stack
Facts go above the content, then the form and the activity; the inspector follows the content below xl.
Required states
StateProves
state-changedAn action changes the status in the page head, removes the action that no longer applies and adds an activity entry.
confirm-openThe destructive action asks first and names the record. Only when the record has a destructive or irreversible action.
note-savedThe team's form saves on its own and confirms it. Only when the team can add to the record.

Code

src/patterns/record-detail/Example.tsx
"use client";

// Client component: it holds the record's state. Client components import from src/ds by path (CLAUDE.md).
import { useState } from "react";
import { Button } from "@/ds/Button/Button";
import { Columns } from "@/ds/Columns/Columns";
import { DescriptionList } from "@/ds/DescriptionList/DescriptionList";
import { Dialog } from "@/ds/Dialog/Dialog";
import { Form } from "@/ds/Form/Form";
import { Heading } from "@/ds/Heading/Heading";
import { List } from "@/ds/List/List";
import { PageHead } from "@/ds/PageHead/PageHead";
import { Pill, type PillVariant } from "@/ds/Pill/Pill";
import { Textarea } from "@/ds/Textarea/Textarea";

type Status = "open" | "approved" | "rejected";

const statusPill: Record<Status, { label: string; variant: PillVariant }> = {
  open: { label: "Open", variant: "info" },
  approved: { label: "Approved", variant: "positive" },
  rejected: { label: "Rejected", variant: "neutral" },
};

export function Example() {
  const [status, setStatus] = useState<Status>("open");
  const [activity, setActivity] = useState(["2026-11-10 · Received", "2026-11-09 · Created by Placeholder: person"]);
  const act = (next: Status, event: string) => {
    setStatus(next);
    setActivity((entries) => [`2026-11-13 · ${event}`, ...entries]);
  };
  const pill = statusPill[status];

  return (
    // Inside AppShell the shell spaces the regions; here the build does it itself.
    <div className="flex flex-col gap-region">
      {/* On a screen: as="h1" (the build sits under the docs page's own headings). */}
      <PageHead
        as="h2"
        size="md"
        eyebrow="Request"
        title="Request “Atlas”"
        status={<Pill variant={pill.variant}>{pill.label}</Pill>}
        actions={
          status === "open" ? (
            <>
              <Button variant="primary" onClick={() => act("approved", "Approved")}>
                Approve
              </Button>
              <Dialog
                trigger="Reject"
                triggerVariant="danger"
                tone="danger"
                form
                title="Reject request “Atlas”?"
                confirmLabel="Reject request"
                cancelLabel="Keep request"
                action={() => act("rejected", "Rejected")}
              >
                <p className="text-secondary">The requester is told, with your reason. This can’t be undone.</p>
                <Textarea label="Reason" name="reject-reason" required />
              </Dialog>
            </>
          ) : undefined
        }
      />
      <Columns layout="aside-main">
        <DescriptionList
          items={[
            { term: "Requester", description: "Placeholder: person" },
            { term: "Received", description: "2026-11-10" },
            { term: "Budget", description: "Placeholder: range" },
          ]}
        />
        <div className="flex flex-col gap-stack">
          <Heading as="h3">Request</Heading>
          <p>Placeholder: the request as the requester wrote it.</p>
        </div>
      </Columns>
      <section aria-labelledby="record-note" className="flex flex-col gap-stack">
        <Heading as="h3" id="record-note">
          Internal note
        </Heading>
        <Form label="Internal note" successMessage="Note saved.">
          <Textarea label="Note" name="record-note" hint="Only the team sees this note." required />
          <div>
            <Button type="submit">Save note</Button>
          </div>
        </Form>
      </section>
      <section aria-labelledby="record-activity" className="flex flex-col gap-stack">
        <Heading as="h3" id="record-activity">
          Activity
        </Heading>
        <List items={activity} />
      </section>
    </div>
  );
}

Built from

Seen in: Round 5 request-detail (2026-11-13): status in the lead, decline twice possible, activity without the page's own actions.