Loading component…
Loading component…
The “While you were away” card for a chat thread – how long you were gone, what needs you, what failed and what's done, with one action per row
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AwaySummary from ./away-summary.
import { AwaySummary, type AwayItem } from "@/components/ui/away-summary";
const items: AwayItem[] = [
{ id: "ingest", title: "Ingest pipeline", kind: "needs-you", detail: "Waiting on: Which queue – Kafka or SQS?" },
{ id: "billing", title: "Billing sync", kind: "failed", detail: "Failed: rate limit on Stripe" },
{ id: "auth", title: "Auth refactor", kind: "done", detail: "Opened PR #482" },
];
export function Thread() {
return (
<>
{messagesBefore}
<AwaySummary since={lastSeenAt} items={items} onAction={(id) => openTask(id)} onDismiss={() => markSeen()} />
{messagesAfter}
</>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| since | Date \| number \| string | When the person left – the head reads how long ago (2h 14m), or since 9:40 with timeStyle="clock" | |
| items | AwayItem[] | { id, title, kind, detail?, action? } – what happened, any order; what needs you comes first | |
| kind | "needs-you" \| "failed" \| "done" | Per item – sets the mark, the order and the default action (Decide, Retry, Open) | |
| action | string \| false | Per item – the button's label; false leaves the row without one | |
| onAction | (id, item) => void \| Promise | A row's action was pressed. Return a promise and the button shows it working until it settles | |
| onDismiss | () => void | Got it was pressed – store that the person has seen it | |
| collapsed / defaultCollapsed | boolean | false | Folded into the divider – controlled, or where it starts |
| onCollapsedChange | (collapsed) => void | Folded or opened from the card or the divider | |
| limit | number | 5 | Rows before Show N more |
| timeStyle | "duration" \| "clock" | "duration" | 2h 14m, or since 9:40 |
| now | Date \| number | Now – defaults to the clock, updated every half minute | |
| labels | Partial<AwaySummaryLabels> | Every word on it – title, counts, actions, Show more, Got it, the divider | |
| className | string | Extra class on the root |
Rows keep one height in every state, so nothing below moves when something resolves
Narrow, the counts drop under the title and long titles and details end in … (the full text in a tooltip); on touch screens buttons are 36px tall
A long action label of your own is capped at about 40% of the card and ends in …, so the task keeps its room; a row without detail centers its mark on the title
Right-to-left: lines and buttons follow the card's direction, and each title and detail reads in its own direction
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"