Screens
Handoff Inbox
Where people take over from the bot — escalated conversations by urgency, what the bot already did, reply and hand back.
3 variantsMIT
Preview
Installation
Copies the screen into components/ and installs every component it uses, with their dependencies and theme tokens.
pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/handoff-inbox.jsonUsage
Pass your own data and wire the callbacks to your agent runtime.
import { HandoffInbox } from "@/components/handoff-inbox";
export function SupportInbox({ inbox, chat }: { inbox: Inbox; chat: Chat }) {
return (
<div className="h-dvh">
<HandoffInbox
data={{
team: inbox.teamName,
operator: { id: inbox.me.id, name: inbox.me.name },
bot: { name: "Nora" },
queue: inbox.escalations, // customer, snippet, reason, waiting minutes…
activeId: chat.id,
messages: chat.turns.map((t) => ({
id: t.id,
from: t.handoff ? "handoff" : t.author, // "customer" | "bot" | "operator"
at: t.createdAt,
content: t.text,
})),
summary: chat.botSummary, // { wants, tried, calls }
suggestions: chat.draftedReplies,
customer: chat.customer, // plan, orders + orderColumns, notes
}}
status={chat.takenBy ? "active" : "waiting"}
onTakeOver={() => chat.takeOver()}
onSend={(text) => chat.reply(text)}
onHandBack={() => chat.handBack()}
onSelect={(escalation) => inbox.open(escalation.id)}
/>
</div>
);
}
// While the inbox loads, pass null explicitly — the skeleton keeps the queue,
// conversation and details panes in place, and the dock still matches status.
// Keep stale data and set loading when refetching.
export function SupportInboxState({ query }: { query: InboxQuery }) {
return (
<div className="h-dvh">
<HandoffInbox
data={query.data ? toInboxData(query.data) : null}
loading={query.isRefetching}
skeleton={{ queue: 4, messages: 5 }}
/>
</div>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data* | HandoffInboxData | null | — | The queue, the open conversation, the bot's summary and drafted replies, and the customer's details. Pass null while loading: the three panes render a layout-preserving skeleton instead. |
| loading | boolean | — | Force the skeleton while refetching, even when stale data is available. The filtered-empty queue and the wrong takeover state never flash while this or a null `data` is in effect. |
| skeleton | { queue?: number; messages?: number } | — | Shape hints for the loading state: how many escalation rows and message bubbles to draw before the real cardinality is known. Falls back to stale data lengths, then to small defaults. `status` is still honored, so the dock matches the composer's or the takeover bar's shape. |
| status | "waiting" | "active" | "returned" | "waiting" | Waiting: the bot holds the chat and Take over is offered. Active: the operator replies from the composer. Returned: handed back to the bot. |
| onTakeOver | () => void | — | The operator joins the chat. |
| onHandBack | () => void | — | The bot takes the chat back. |
| onSend | (text: string) => void | — | A reply from the operator. |
| onSelect | (escalation: Escalation) => void | — | A conversation picked in the queue (click, or arrow keys and Enter). |
| draft / onDraftChange | string / (draft: string) => void | — | Controls the composer text. Picking a drafted reply fills it for editing before sending. |
| queueOpen / defaultQueueOpen / onQueueOpenChange | boolean / boolean / (open: boolean) => void | true | The queue pane from 56rem wide; toggle with its header button or Cmd/Ctrl + backslash. Narrower, it opens as a drawer. |
| detailsOpen / defaultDetailsOpen / onDetailsOpenChange | boolean / boolean / (open: boolean) => void | true | The customer details pane from 72rem wide; a drawer below that. |
| labels | Partial<HandoffInboxLabels> | — | Your own UI strings (header lines, queue, filters, summary, Take over, the `loading` screen-reader announcement…), plus `thread`, `composer`, `suggestions`, `toolCall`, `table`, `memory` and `avatar` labels passed to those components, for translating. Right-to-left works under `dir="rtl"`: the queue moves to the right, details to the left. |
| locale | string | "en-US" | Intl locale for message times, e.g. `he-IL`. |
| className | string | — | Extra classes for the root. |
type Escalation = {
id: string;
customer: { name: string; avatar?: string };
snippet: string; // last thing the customer said
reason: string; // why the bot handed off
tone?: StatusTone;
urgent?: boolean;
waiting: number; // minutes waiting for a person
assignee?: string; // operator id; drives the "Mine" filter
};
type HandoffMessage = {
id: string;
from: "customer" | "bot" | "operator" | "handoff";
at: string; // ISO
content: React.ReactNode;
};
type HandoffInboxData = {
team: string;
operator: { id: string; name: string; avatar?: string };
bot: { name: string };
queue: Escalation[];
activeId?: string;
messages: HandoffMessage[];
summary: { wants: string; tried: string[]; calls?: ToolCall[] };
suggestions?: PromptSuggestion[];
customer: {
name: string; avatar?: string;
plan: string; planTone?: StatusTone; since: string;
orders: DataRow[]; orderColumns: DataColumn[];
notes: Memory[];
};
};
// The screen fills its parent and lays out by its own width (container queries).
// Give the parent a height.