Shows who wrote something: a person, an agent, or an agent for a person.
Hi Dana, your refund of $48.20 is on its way.
Sent byScouton behalf ofAda Lovelaceapproved byBen OkaforView runClosed 9 duplicates of PAY-398.
Nightly triagevia the issue trackerUpdated 214 contacts.
Imported byContacts syncvia the API- BOEdited byBen Okafor
Priority: High
AI
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import type { Actor } from "./ui/uicontext/components/domain/Actor.ts"import { AiMark, Attribution } from "./ui/uicontext/components/kit/Attribution.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, font, radius, space } from "./ui/uicontext/components/tokens.stylex.ts"import { ada, ben, scout } from "./team.ts"// Under each outward action: who did it, for whom, how it came in and who approved it.const styles = stylex.create({ list: { display: "grid", gap: space.lg, inlineSize: "min(100%, 34rem)", margin: 0, padding: 0, listStyle: "none" }, card: { display: "grid", gap: space.xs, padding: space.md, borderRadius: radius.md, borderWidth: 1, borderStyle: "solid", borderColor: color.line, backgroundColor: color.panel, }, text: { margin: 0, color: color.fg, fontSize: font.base }, row: { display: "flex", alignItems: "center", gap: space.sm },})const nightly: Actor = { id: "nightly", name: "Nightly triage", kind: "routine", href: "#routine-nightly" }const crm: Actor = { id: "crm", name: "Contacts sync", kind: "integration" }export const Bylines = <M>(h: Html.H<M>) => h.ul.attrs(sx(styles.list)).children( h.li.attrs(sx(styles.card)).children( h.p.attrs(sx(styles.text)).children("Hi Dana, your refund of $48.20 is on its way."), Attribution(h, { action: "Sent", actor: scout, onBehalfOf: ada, approvedBy: ben, at: "2026-12-01T10:02:00Z", href: "#run-412", hrefLabel: "View run", timeZone: "UTC", }), ), h.li.attrs(sx(styles.card)).children( h.p.attrs(sx(styles.text)).children("Closed 9 duplicates of PAY-398."), Attribution(h, { actor: nightly, via: "the issue tracker", at: "2026-12-01T02:00:00Z", timeZone: "UTC" }), ), h.li.attrs(sx(styles.card)).children( h.p.attrs(sx(styles.text)).children("Updated 214 contacts."), Attribution(h, { action: "Imported", actor: crm, via: "the API", timeZone: "UTC", at: "2026-11-30T18:30:00Z" }), ), h.li.attrs(sx(styles.card)).children( h.div.attrs(sx(styles.row)).children(h.p.attrs(sx(styles.text)).children("Priority: High"), AiMark(h, { title: "Scout set this from the report's wording" })), Attribution(h, { action: "Edited", actor: ben, avatar: true, at: "2026-12-01T09:12:00Z", timeZone: "UTC" }), ), )Installation
pnpm dlx shadcn@latest add checkfu/uicontext/attributionUsage
import type { Actor } from "./ui/uicontext/components/domain/Actor.ts"import { Attribution } from "./ui/uicontext/components/kit/Attribution.ts"export const SentBy = <M>(h: Html.H<M>, reply: { readonly agent: Actor; readonly forPerson: Actor; readonly at: string }) => Attribution(h, { action: "Sent", actor: reply.agent, onBehalfOf: reply.forPerson, at: reply.at })Examples
Compact
compact: true draws only the actor's mark: a letter for a person, ✦ for an agent.
| Field | Value |
|---|---|
| Status | In ReviewB |
| Summary | Retries reuse the key✦ |
| Owner | Mira PatelA |
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Attribution } from "./ui/uicontext/components/kit/Attribution.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, font, space } from "./ui/uicontext/components/tokens.stylex.ts"import { ada, ben, scout } from "./team.ts"// In a dense table, only the mark shows; its full sentence is the accessible name and the tooltip.const styles = stylex.create({ table: { borderCollapse: "collapse", fontSize: font.sm, color: color.fg, inlineSize: "min(100%, 28rem)" }, cell: { paddingBlock: space.sm, paddingInline: space.md, borderBottomWidth: 1, borderBottomStyle: "solid", borderBottomColor: color.line, textAlign: "start" }, value: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: space.sm }, head: { color: color.muted, fontWeight: 500 },})const rows = [ { field: "Status", value: "In Review", by: { action: "Changed", actor: ben } }, { field: "Summary", value: "Retries reuse the key", by: { action: "Written", actor: scout, onBehalfOf: ada } }, { field: "Owner", value: "Mira Patel", by: { action: "Assigned", actor: ada } },]export const FieldSources = <M>(h: Html.H<M>) => h.table.attrs(sx(styles.table)).children( h.thead.children( h.tr.children(h.th.attrs(sx(styles.cell, styles.head)).children("Field"), h.th.attrs(sx(styles.cell, styles.head)).children("Value")), ), h.tbody.children( ...rows.map((row) => h.tr.key(row.field).children( h.td.attrs(sx(styles.cell)).children(row.field), h.td.attrs(sx(styles.cell)).children(h.span.attrs(sx(styles.value)).children(row.value, Attribution(h, { ...row.by, compact: true }))), ), ), ), )Long names
Parts wrap onto the next line; a single name longer than the line is cut with an ellipsis.
Drafted byEnterprise renewals assistant for the Northwind Freight account teamon behalf ofMaximilian Kowalczyk-Oyelaranvia the shared inbox
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import type { Actor } from "./ui/uicontext/components/domain/Actor.ts"import { Attribution } from "./ui/uicontext/components/kit/Attribution.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, radius, space } from "./ui/uicontext/components/tokens.stylex.ts"// A narrow side panel: the line wraps between parts, and a name too long for the panel ends in an// ellipsis, with the whole name in its tooltip.const styles = stylex.create({ panel: { inlineSize: 240, maxInlineSize: "100%", padding: space.md, borderRadius: radius.md, borderWidth: 1, borderStyle: "solid", borderColor: color.line, },})const agent: Actor = { id: "renewals", name: "Enterprise renewals assistant for the Northwind Freight account team", kind: "agent" }const person: Actor = { id: "mk", name: "Maximilian Kowalczyk-Oyelaran", kind: "person" }export const NarrowPanel = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.panel)).children( Attribution(h, { action: "Drafted", actor: agent, onBehalfOf: person, via: "the shared inbox", at: "2026-12-01T08:45:00Z", timeZone: "UTC" }), )API reference
AttributionView function
Options
| Name | Type | Default | Description |
|---|---|---|---|
compact | boolean | — | Only the actor's mark, with the sentence as its accessible name (a cell's corner) |
avatar | boolean | — | Show the actor's avatar before the line |
words | AttributionWords | English | The words between the names ("by", "on behalf of", "via"), for other languages; English by default |
locale | string | — | The locale for the time; the reader's when left out |
timeZone | string | — | The time zone for the time; the reader's when left out |
AiMarkView function
Options
| Name | Type | Default | Description |
|---|---|---|---|
label | string | "AI" | The mark's text; "AI" by default |
title | string | — | The tooltip that explains the mark; "Written by AI" by default |
Accessibility
- The line is plain text: what happened, who did it, who for and who approved it, with the time as a
<time>. - The compact mark is an image named with that whole sentence. Agents, routines and integrations have their own mark, so an agent never reads as a person.