Attribution

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 run
  • Closed 9 duplicates of PAY-398.

    Nightly triagevia the issue tracker
  • Updated 214 contacts.

    Imported byContacts syncvia the API
  • Priority: High

    AI
    BOEdited byBen Okafor

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/attribution

Usage

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.

FieldValue
StatusIn ReviewB
SummaryRetries reuse the key✦
OwnerMira PatelA

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

API reference

AttributionView function

Options

Attribution options
NameTypeDefaultDescription
compactboolean—Only the actor's mark, with the sentence as its accessible name (a cell's corner)
avatarboolean—Show the actor's avatar before the line
wordsAttributionWordsEnglishThe words between the names ("by", "on behalf of", "via"), for other languages; English by default
localestring—The locale for the time; the reader's when left out
timeZonestring—The time zone for the time; the reader's when left out

AiMarkView function

Options

AiMark options
NameTypeDefaultDescription
labelstring"AI"The mark's text; "AI" by default
titlestring—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.

Source