Record Detail

One record's title, fields and actions, edited in place.

Sign-in links last 10 minutes, but the mail queue can take up to 14 at peak. Raise the lifetime to 30 minutes and add a test for a slow queue.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/detail

Usage

import type { Outcome } from "./ui/uicontext/components/domain/Outcome.ts"import { type Item, type Property, Value } from "./ui/uicontext/components/domain/Record.ts"import { Detail } from "./ui/uicontext/components/kit/Detail.ts"
const Message = UiSchema.TaggedEnum({	RequestedEditTask: { request: Schema.String, item: Schema.String, key: Schema.String, value: Value },	RequestedArchive: { id: Schema.String },})export const TaskPage = (h: Html.H<typeof Message.Type>, task: Item, fields: ReadonlyArray<Property>, outcomes: ReadonlyArray<Outcome>) =>	Detail(h, {		props: { record: task, fields, titleEditable: true, actions: [{ id: "archive", label: "Archive" }], outcomes },		onEmit: {			RequestedOpen: () => undefined,			RequestedEdit: (edit) => Message.RequestedEditTask(edit),			RequestedAction: ({ items }) => Message.RequestedArchive({ id: items[0] ?? task.id }),		},		slots: { body: h.p.children(task.note ?? "") },	})

Examples

Archived

A banner with an action, every field locked with the reason, and a shorter properties panel.

Dark mode contrast on badges

This issue was archived on 24 November.

Badge text on the dark theme was 3.9:1. Raised it to 4.6:1 for every status color.

Stepping through a list

The arrows in the header, or j and k, open the previous and next record. Activity sits under the body.

3 of 12

No description yet.

Saturday, Nov 28

  1. Ada Lovelacecreated the issue

Yesterday

  1. ScoutforAda Lovelaceset the priorityHigh

API reference

Props

Detail props
NameTypeDefaultDescription
agentIdstringdetail:<record id>This pane's id for agents, unique on the page; detail:<record id> by default
recordrequiredItem—The record this page shows
fieldsrequiredProperty[]—Every field the record can have, with its kind and choices
panelstring[]—Which fields the panel shows, in order; every field by default
titleEditableboolean—The title can be edited here
trailstring[]—What the trail above the title says: ["Engineering", "ENG-12"]
bannerDetailBanner | null—A line above the body, such as a duplicate notice, with an optional button
actionsItemAction[]—Buttons in the header: "Archive", "Delete" (consequential)
readOnlystring—Why nothing here can be edited: "This issue is in the trash"
loadingboolean—Shows placeholders while the record loads
outcomesOutcome[]—How the app settled each requested edit: pending, accepted, or refused with a reason
showLocksbooleanoffA lock beside read-only properties; off by default (their reason shows on focus either way)
panelLabelstring"Properties"The side panel's heading; "Properties" by default
localestring—The locale numbers and dates are formatted in; the browser's by default
position{ index, count, previous, … }—Where the record sits in the list it was opened from, with its neighbours' ids: the header shows "3 of 40" and steps to them, by its buttons or j and k

Events

Detail events
EventPayloadDescription
RequestedEdit{}One field's (or the title's) new value; answer through outcomes with the same request
RequestedAction{}A header or banner action, on this record: items is [record.id]
RequestedOpen{}The previous or next record, from position: open it

Slots

body, activity, footer

Agent actions

What agents can do with Detail
ActionDescription
ClickedStepOpen the previous (by -1) or next (by 1) record of the list this one was opened from
CommittedEditSet one field (or title). value: an option value, a list of them (multi-select, relation), text, a number (number, rating), an ISO date, true/false, a list of file URLs, or null to clear. Rollups and formulas are computed and can't be set
ClickedActionRun one of the header's actions; destructive ones name this item as the target
ClickedBannerActionPress the banner's button (see the banner)

Accessibility

  • Each field is a button that opens its editor; Escape closes it without saving.
  • A read-only field says why when it has focus or is tapped, read as its description, and a refused edit restores the old value.

Source