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.
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Outcome } from "./ui/uicontext/components/domain/Outcome.ts"import { Detail } from "./ui/uicontext/components/kit/Detail.ts"import { Item, Value } from "./ui/uicontext/components/kit/Property.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color } from "./ui/uicontext/components/tokens.stylex.ts"import { applyEdit, issueFields, issues } from "./issues.ts"const styles = stylex.create({ frame: { inlineSize: "100%" }, body: { margin: 0, color: color.muted, lineHeight: 1.6 },})const Message = UiSchema.TaggedEnum({ RequestedEditIssue: { request: Schema.String, item: Schema.String, key: Schema.String, value: Value },})export const IssueDetail = Html.component({ name: "IssueDetail", model: Schema.Struct({ record: Item, outcomes: Schema.Array(Outcome) }), message: Message,}).make({ init: () => ({ record: issues[0]!, outcomes: [] }), update: { RequestedEditIssue: ($, { request, key, value }) => $.evolve({ record: (record) => applyEdit(record, key, value), outcomes: (o) => [...o.slice(-10), { _tag: "Accepted", request }], }), }, view: (h, { record, outcomes }) => h.div.attrs(sx(styles.frame)).children( Detail(h, { props: { record, fields: issueFields, titleEditable: true, trail: ["Engineering", record.prefix ?? record.id], actions: [{ id: "archive", label: "Archive" }], outcomes, }, onEmit: { RequestedOpen: () => undefined, RequestedEdit: (edit) => Message.RequestedEditIssue(edit), RequestedAction: () => undefined, }, slots: { body: h.p.attrs(sx(styles.body)).children( "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/detailUsage
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.
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Detail } from "./ui/uicontext/components/kit/Detail.ts"import { Item } from "./ui/uicontext/components/kit/Property.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color } from "./ui/uicontext/components/tokens.stylex.ts"import { issueFields, issues } from "./issues.ts"// An archived issue: a banner says so and offers Restore, `readOnly` locks every field with the// reason, and `panel` shows only the fields that matter here.const styles = stylex.create({ frame: { inlineSize: "100%" }, body: { margin: 0, color: color.muted, lineHeight: 1.6 },})const Message = UiSchema.TaggedEnum({ RequestedRestore: {} })export const ArchivedIssue = Html.component({ name: "ArchivedIssue", model: Schema.Struct({ record: Item, archived: Schema.Boolean }), message: Message,}).make({ init: () => ({ record: issues.find((issue) => issue.id === "eng-118")!, archived: true }), update: { RequestedRestore: ($) => $.evolve({ archived: false }) }, view: (h, { record, archived }) => h.div.attrs(sx(styles.frame)).children( Detail(h, { props: { record, fields: issueFields, panel: ["status", "assignee", "labels", "due"], trail: ["Design", record.prefix ?? record.id], banner: archived ? { tone: "warning", text: "This issue was archived on 24 November.", action: { id: "restore", label: "Restore" } } : null, ...(archived ? { readOnly: "Restore the issue to edit it." } : {}), }, onEmit: { RequestedOpen: () => undefined, RequestedAction: () => Message.RequestedRestore(), RequestedEdit: () => undefined, }, slots: { body: h.p.attrs(sx(styles.body)).children("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
Yesterday
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Outcome } from "./ui/uicontext/components/domain/Outcome.ts"import { Activity } from "./ui/uicontext/components/kit/Activity.ts"import { Detail } from "./ui/uicontext/components/kit/Detail.ts"import { Item, Value } from "./ui/uicontext/components/kit/Property.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color } from "./ui/uicontext/components/tokens.stylex.ts"import { applyEdit, issueFields, issues } from "./issues.ts"import { ada, now, scout } from "./team.ts"// A triage pass: the arrows in the header, or j and k, open the previous and next issue of the// list this one came from. The activity slot holds the record's history; the app decides what// goes there.const styles = stylex.create({ frame: { inlineSize: "100%" }, body: { margin: 0, color: color.muted, lineHeight: 1.6 },})const Message = UiSchema.TaggedEnum({ RequestedEditIssue: { request: Schema.String, item: Schema.String, key: Schema.String, value: Value }, RequestedOpenIssue: { item: Schema.String },})export const TriageDetail = Html.component({ name: "TriageDetail", model: Schema.Struct({ records: Schema.Array(Item), open: Schema.String, outcomes: Schema.Array(Outcome) }), message: Message,}).make({ init: () => ({ records: issues, open: issues[2]!.id, outcomes: [] }), update: { RequestedEditIssue: ($, { request, item, key, value }) => $.evolve({ records: (records) => records.map((r) => (r.id === item ? applyEdit(r, key, value) : r)), outcomes: (o) => [...o.slice(-10), { _tag: "Accepted", request }], }), RequestedOpenIssue: ($, { item }) => $.evolve({ open: item }), }, view: (h, { records, open, outcomes }) => { const index = Math.max(0, records.findIndex((r) => r.id === open)) const record = records[index]! return h.div.attrs(sx(styles.frame)).children( Detail(h, { props: { agentId: "detail:triage", record, fields: issueFields, titleEditable: true, trail: ["Engineering", "Triage", record.prefix ?? record.id], position: { index, count: records.length, previous: records[index - 1]?.id ?? null, next: records[index + 1]?.id ?? null, }, outcomes, }, onEmit: { RequestedEdit: (edit) => Message.RequestedEditIssue(edit), RequestedOpen: ({ item }) => Message.RequestedOpenIssue({ item }), RequestedAction: () => undefined, }, slots: { body: h.p.attrs(sx(styles.body)).children(record.note ?? "No description yet."), activity: Activity(h, { key: record.id, props: { label: "Activity", agentId: "activity:triage", now, entries: [ { id: `${record.id}-1`, actor: ada, action: "created the issue", at: "2026-11-28T09:12:00Z" }, { id: `${record.id}-2`, actor: scout, onBehalfOf: ada, action: "set the priority", to: { label: "High" }, at: "2026-11-30T16:40:00Z", }, ], }, onEmit: { RequestedRestore: () => undefined }, }), }, }), ) },})API reference
Props
| Name | Type | Default | Description |
|---|---|---|---|
agentId | string | detail:<record id> | This pane's id for agents, unique on the page; detail:<record id> by default |
recordrequired | Item | — | The record this page shows |
fieldsrequired | Property[] | — | Every field the record can have, with its kind and choices |
panel | string[] | — | Which fields the panel shows, in order; every field by default |
titleEditable | boolean | — | The title can be edited here |
trail | string[] | — | What the trail above the title says: ["Engineering", "ENG-12"] |
banner | DetailBanner | null | — | A line above the body, such as a duplicate notice, with an optional button |
actions | ItemAction[] | — | Buttons in the header: "Archive", "Delete" (consequential) |
readOnly | string | — | Why nothing here can be edited: "This issue is in the trash" |
loading | boolean | — | Shows placeholders while the record loads |
outcomes | Outcome[] | — | How the app settled each requested edit: pending, accepted, or refused with a reason |
showLocks | boolean | off | A lock beside read-only properties; off by default (their reason shows on focus either way) |
panelLabel | string | "Properties" | The side panel's heading; "Properties" by default |
locale | string | — | 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
| Event | Payload | Description |
|---|---|---|
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
| Action | Description |
|---|---|
ClickedStep | Open the previous (by -1) or next (by 1) record of the list this one was opened from |
CommittedEdit | Set 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 |
ClickedAction | Run one of the header's actions; destructive ones name this item as the target |
ClickedBannerAction | Press 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.