# Away summary

The short catch-up where the person left off: what needs you, what failed and what is done, one action per row, and Got it folds it into a divider.

Live variants: https://design.arcadia.is/components/away-summary

```tsx
import {
  AwaySummary, sortAwayItems, awayCounts, awayDuration, awayClock, awayRoom,
  awayShown,
} from "@arcadia/ui";
```

What needs you stands first, then what failed, then what is done. Each row says its state in words beside its mark, and its button names its task. On a phone a row with a button lets the button say it.

```tsx
import { AwaySummary } from "@arcadia/ui";

function Inbox() {
  const now = new Date(2026, 10, 26, 11, 54);
  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 at the payment provider" },
    { id: "auth", title: "Auth refactor", kind: "done", detail: "Opened pull request #482" },
    { id: "export", title: "Usage export", kind: "done", detail: "Sent to the finance channel" },
  ];
  return (
    <div {...sx("cmp-away-thread", AwaySummaryStyles.thread)}>
      <AwaySummary since={new Date(2026, 10, 26, 9, 40)} now={now} items={items} onAction={() => {}} onDismiss={() => {}} />
    </div>
  );
}
```

## Accessibility

The summary is a region named by its heading, which says how long the person was away, and its rows are a list. Every row says its state in words beside its mark, so no state rests on colour, and every button names its task: Decide: Ingest pipeline. Under `--breakpoint-compact` a row with a button drops the state word, and the button's word and name carry it: Decide is what needs you, Retry what failed, Open what is done.

Got it says `aria-expanded="true"` and points at the body it folds whenever there are rows; with nothing to fold it says neither. The divider says `aria-expanded="false"` and, because the card leaves the page, points at nothing. Got it folds the card and records it as seen, never an answer; a working action keeps focus, says `aria-busy` and refuses a second press until its promise settles, and a refusal appears on its row in the danger ink and is announced. Show more carries `aria-expanded` and points at the list; it moves focus to the first new row's action, Show less keeps it on the toggle, and the divider returns focus to where it was left.

## API reference

### AwaySummary

- `since` (`Date | number | string`, required): When the person left: a Date, milliseconds, or a date string.
- `items` (`readonly AwayItem[]`, required): What happened while they were away, in any order: what needs you stands first, then what failed, then what is done.
- `onAction` (`(id: string, item: AwayItem) => void | Promise<void>`): One authorized action per row. Without it the rows are a summary only, and no row draws a button.
- `onActionError` (`(id: string, error: unknown) => void`): An action's promise was refused: the row says why in the danger ink, and the product hears the reason.
- `onDismiss` (`() => void`): Got it was pressed: record that the person has seen the summary. It never approves, rejects or clears a pending item.
- `collapsed` (`boolean`): Folded into the one-line divider while true.
- `defaultCollapsed` (`boolean`, default `false`): Folded when it first draws.
- `onCollapsedChange` (`(collapsed: boolean) => void`): Called when the card, Got it or the divider folds or opens it.
- `limit` (`number`, default `5`): Rows drawn before Show N more.
- `timeStyle` (`"duration" | "clock"`, default `"duration"`): Default duration: "2h 14m". Clock: "since 9:40".
- `now` (`Date | number`): The reference time. Default: the clock, read every half minute. A host that renders on the server without `suppressHydrationWarning` passes it, so the server and the first client frame agree.
- `labels` (`Partial<AwaySummaryLabels>`): Every word on it.
- `rootStyle` (`RootStyle`): Typed StyleX override: where it sits.
