A record's page

Its content, its properties beside it, its history

6 min readWritten for your agentMarkdown

This recipe draws RecordPage arrangement="aside"; the others (agent/layout-chooser.md) take the same slots. Your page fits another? Change the one prop:

  • column (body: long): body long text; properties a few, or none.
  • profile (subject: person): titleMedia an avatar; properties the person’s facts.
  • tabbed (related: many): body tabs of the related lists.
  • sections-nav (body: long, sections: many; Trail draws it as column): body headed parts, one a section.
  • band (properties: few; Trail draws it as column): properties a few, above the body.

Copy the file below whole (src/screens/issue.tsx, say) beside frame.tsx (docs/screen-frame.md) and swap the sample record for yours; keep the parts and their props. RecordPage: the record's name as the heading, a Breadcrumb, its one main action, its text, its properties in the side panel (under the text on a phone), its history. The properties are edited in place (Properties, a PropertyRow each): the status and the priority a SelectTrigger shape="chip", the assignee a PersonSelect shape="chip", bordered chips that read as controls at rest; a row's label names its control and opens it. The main action and the status chip hold one status. Light, dark, phone and desktop are the parts' own: add no class for them.

The parts that give the page its depth, each where a record needs it:

  • InlineEdit is the title (as="span" variant="title" multiline: RecordPage's own h1 holds it): a click, Enter or F2 edits the name in place, Escape puts it back. Short words in a property row take an InlineEdit too; an edit form only when many fields change together.
  • Identity is a person in a property (the reporter, a contact), their name the link to them; wrap the Identity in HoverCardTrigger asChild and put HoverCardPerson in the HoverCardContent, so resting on them or focusing the name previews who they are.
  • A link to another record (the parent, a related issue) previews in a HoverCard too: the trigger is the Link, the card a MetaFacts of the record's short facts (asChild on a div, stack="always"). Never a control in a card.
  • AvatarGroup is several people on the record (who watches it, a deal's team), named by its aria-label; one person is an Identity.
  • CommentThread is a discussion to resolve (replies, reactions, Resolve), under the history in activity; a line of history with a note stays an ActivityItem. Hold its replies and resolved in your state.
Show the code273 lines
TSX
// src/screens/issue.tsx: one record’s page
import { useState } from 'react';
import { RecordPage } from '@/components/goop/patterns/record-page';
import {
  ActivityItem,
  ActivityItemActor,
  ActivityItemAside,
  ActivityItemBody,
  ActivityItemContent,
  ActivityItemMedia,
  ActivityItemName,
} from '@/components/ui/goop/activity-item';
import { Avatar, AvatarFallback } from '@/components/ui/goop/avatar';
import { AvatarGroup } from '@/components/ui/goop/avatar-group';
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList } from '@/components/ui/goop/breadcrumb';
import { Button } from '@/components/ui/goop/button';
import { CommentThread, type ThreadComment } from '@/components/ui/goop/comment-thread';
import { HoverCard, HoverCardContent, HoverCardPerson, HoverCardTrigger } from '@/components/ui/goop/hover-card';
import { Identity } from '@/components/ui/goop/identity';
import { InlineEdit } from '@/components/ui/goop/inline-edit';
import { Link } from '@/components/ui/goop/link';
import { MetaFacts, MetaFactsItem, MetaFactsLabel, MetaFactsValue } from '@/components/ui/goop/meta-facts';
import { PersonSelect } from '@/components/ui/goop/person-select';
import { type PriorityLevel, PriorityMark } from '@/components/ui/goop/priority-mark';
import { Properties, PropertyRow } from '@/components/ui/goop/properties';
import { Prose } from '@/components/ui/goop/prose';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/goop/select';
import { type StatusKind, StatusMark } from '@/components/ui/goop/status-mark';
import { ScreenFrame, ScreenTopBar } from './frame';
import { hrefOf } from './router';

// ---- the sample data: swap it for yours
type Status = Extract<StatusKind, 'todo' | 'in-progress' | 'in-review' | 'done'>;
const STATUS_WORDS: Record<Status, string> = {
  todo: 'To do',
  'in-progress': 'In progress',
  'in-review': 'In review',
  done: 'Done',
};
const STATUSES = Object.keys(STATUS_WORDS) as Status[];
const PRIORITY_WORDS: Record<PriorityLevel, string> = {
  none: 'No priority',
  urgent: 'Urgent',
  high: 'High',
  medium: 'Medium',
  low: 'Low',
};
const PRIORITIES = Object.keys(PRIORITY_WORDS) as PriorityLevel[];
const TEAM = [
  { id: 'bilal', name: 'Bilal Rashed' },
  { id: 'dagny', name: 'Dagny Holm' },
  { id: 'teodora', name: 'Teodora Valk' },
];
const ISSUE = {
  id: 'FW-121',
  title: 'Tags vanish after a sync on tablets',
  status: 'in-review' as Status,
  priority: 'urgent' as PriorityLevel,
  assignee: 'bilal',
  reporter: { id: 'teodora', name: 'Teodora Valk', role: 'Founder', email: 'teodora@fieldwork.test' },
  watchers: ['Teodora Valk', 'Bilal Rashed', 'Dagny Holm'],
  parent: {
    id: 'FW-118',
    title: 'Sync keeps every tag a note had',
    status: 'in-progress' as Status,
    assignee: 'Dagny Holm',
  },
  text: ['Tags added while a note is open can vanish after the next sync.', 'A reload brings them back.'],
};
const HISTORY = [
  { id: 'c1', who: 'Teodora Valk', initials: 'TV', when: '2 days ago', words: 'Saw it twice on long notes.' },
  { id: 'c2', who: 'Bilal Rashed', initials: 'BR', when: 'Yesterday', words: 'Repro’d on my tablet.' },
];

const THREAD: ThreadComment = {
  id: 't1',
  author: { name: 'Dagny Holm' },
  time: 'Yesterday',
  body: 'Should a sync ever drop a tag, or ask first?',
  reactions: [{ emoji: '👍', label: 'Thumbs up', count: 2 }],
};

export default function IssueScreen() {
  const [title, setTitle] = useState(ISSUE.title);
  const [replies, setReplies] = useState<ThreadComment[]>([]);
  const [resolved, setResolved] = useState(false);
  const [status, setStatus] = useState(ISSUE.status);
  const [priority, setPriority] = useState(ISSUE.priority);
  const [assignee, setAssignee] = useState(ISSUE.assignee);
  const done = status === 'done';
  return (
    <ScreenFrame>
      <RecordPage
        arrangement="aside"
        header={<ScreenTopBar title={ISSUE.id} />}
        trail={
          <Breadcrumb>
            <BreadcrumbList>
              <BreadcrumbItem>
                <BreadcrumbLink href={hrefOf('/issues')}>Issues</BreadcrumbLink>
              </BreadcrumbItem>
            </BreadcrumbList>
          </Breadcrumb>
        }
        title={
          <InlineEdit
            as="span"
            variant="title"
            multiline
            label="Title"
            value={title}
            onValueChange={(words) => words.trim() && setTitle(words.trim())}
          />
        }
        primaryAction={
          <Button variant={done ? 'outline' : 'primary'} onClick={() => setStatus(done ? 'in-progress' : 'done')}>
            {done ? 'Reopen' : 'Mark as done'}
          </Button>
        }
        body={
          <Prose asChild>
            <div>
              {ISSUE.text.map((paragraph) => (
                <p key={paragraph}>{paragraph}</p>
              ))}
            </div>
          </Prose>
        }
        properties={
          <Properties aria-label="Properties">
            <PropertyRow label="Status" icon="circle-dashed">
              {(control) => (
                <Select value={status} onValueChange={(next) => setStatus(next as Status)}>
                  <SelectTrigger {...control} shape="chip">
                    <SelectValue />
                  </SelectTrigger>
                  <SelectContent aria-label="Status" search={false}>
                    {STATUSES.map((value) => (
                      <SelectItem
                        key={value}
                        value={value}
                        mark={<StatusMark status={value} size="sm" aria-hidden="true" />}
                      >
                        {STATUS_WORDS[value]}
                      </SelectItem>
                    ))}
                  </SelectContent>
                </Select>
              )}
            </PropertyRow>
            <PropertyRow label="Priority" icon="antenna-bars-3">
              {(control) => (
                <Select value={priority} onValueChange={(next) => setPriority(next as PriorityLevel)}>
                  <SelectTrigger {...control} shape="chip">
                    <SelectValue />
                  </SelectTrigger>
                  <SelectContent aria-label="Priority" search={false}>
                    {PRIORITIES.map((value) => (
                      <SelectItem
                        key={value}
                        value={value}
                        mark={<PriorityMark priority={value} size="sm" aria-hidden="true" />}
                      >
                        {PRIORITY_WORDS[value]}
                      </SelectItem>
                    ))}
                  </SelectContent>
                </Select>
              )}
            </PropertyRow>
            <PropertyRow label="Assignee" icon="user">
              <PersonSelect shape="chip" people={TEAM} optional value={assignee} onValueChange={setAssignee} />
            </PropertyRow>
            <PropertyRow label="Reporter">
              <HoverCard>
                <HoverCardTrigger asChild>
                  <Identity size="sm" orientation="horizontal" name={ISSUE.reporter.name} asChild>
                    <a href={hrefOf(`/people/${ISSUE.reporter.id}`)}>{ISSUE.reporter.name}</a>
                  </Identity>
                </HoverCardTrigger>
                <HoverCardContent>
                  <HoverCardPerson
                    name={ISSUE.reporter.name}
                    description={ISSUE.reporter.role}
                    meta={ISSUE.reporter.email}
                    avatar={
                      <Avatar variant="solid" size="lg" name={ISSUE.reporter.name}>
                        <AvatarFallback>TV</AvatarFallback>
                      </Avatar>
                    }
                  />
                </HoverCardContent>
              </HoverCard>
            </PropertyRow>
            <PropertyRow label="Watching">
              <AvatarGroup aria-label="People watching this issue" size="sm" max={3}>
                {ISSUE.watchers.map((name) => (
                  <Avatar key={name} variant="solid" name={name}>
                    <AvatarFallback>{name}</AvatarFallback>
                  </Avatar>
                ))}
              </AvatarGroup>
            </PropertyRow>
            <PropertyRow label="Parent">
              <HoverCard>
                <HoverCardTrigger asChild>
                  <Link variant="plain" href={hrefOf(`/issues/${ISSUE.parent.id}`)}>
                    {ISSUE.parent.title}
                  </Link>
                </HoverCardTrigger>
                <HoverCardContent>
                  <MetaFacts asChild stack="always">
                    <div>
                      <MetaFactsItem>
                        <MetaFactsLabel>Status</MetaFactsLabel>
                        <MetaFactsValue>{STATUS_WORDS[ISSUE.parent.status]}</MetaFactsValue>
                      </MetaFactsItem>
                      <MetaFactsItem>
                        <MetaFactsLabel>Assignee</MetaFactsLabel>
                        <MetaFactsValue>{ISSUE.parent.assignee}</MetaFactsValue>
                      </MetaFactsItem>
                    </div>
                  </MetaFacts>
                </HoverCardContent>
              </HoverCard>
            </PropertyRow>
            <PropertyRow label="Created">2 days ago</PropertyRow>
          </Properties>
        }
        activity={
          <div className="flex flex-col gap-6">
            <ul aria-label="History">
              {HISTORY.map((entry) => (
                <ActivityItem key={entry.id} asChild>
                  <li>
                    <ActivityItemMedia>
                      <Avatar variant="solid" size="3xs" name={entry.who}>
                        <AvatarFallback>{entry.initials}</AvatarFallback>
                      </Avatar>
                    </ActivityItemMedia>
                    <ActivityItemContent>
                      <ActivityItemActor>
                        <ActivityItemName>{entry.who}</ActivityItemName>
                      </ActivityItemActor>{' '}
                      commented
                    </ActivityItemContent>
                    <ActivityItemAside>{entry.when}</ActivityItemAside>
                    <ActivityItemBody>
                      <p>{entry.words}</p>
                    </ActivityItemBody>
                  </li>
                </ActivityItem>
              ))}
            </ul>
            <CommentThread
              comment={THREAD}
              replies={replies}
              onReply={(text) =>
                setReplies((all) => [
                  ...all,
                  { id: `r${all.length + 1}`, author: { name: 'Teodora Valk' }, time: 'Just now', body: text },
                ])
              }
              resolved={resolved}
              onResolve={() => setResolved(true)}
              onReopen={() => setResolved(false)}
            />
          </div>
        }
      />
    </ScreenFrame>
  );
}

The file above is the default. A page planned tabbed copies its named option instead, a whole file in a doc of its own (docs/recipe-record-tabbed.md, same path, same frame): its key facts a band in the header, its body the theme's Tabs, one tab a related list. The default with its one prop changed has no tabs to show. A record that is a person (a teammate, a client, a patient) is the profile option (docs/recipe-record-profile.md): a page of its own beside the record's (/people/<id>), the person in a profile panel at the start, their work beside it.

Which one:

| The record in your product | Copy | | --- | --- | | A record people work on: its text, its properties edited in place beside it (an issue, a task, a ticket) | the default | | A record whose related lists matter most (related: many): a client's invoices and activity, a supplier's orders | tabbed | | A person (subject: person): a teammate, a client, a patient, their facts beside their work | profile |

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.