Agent Approval Inbox & Slide-Over Reading Pane
MSAI one-line scannable agent inbox paired with a slide-over reading pane. Quick Approve/Skip actions live on hover in the list and stay pinned in a fixed decision footer inside the reading pane with Undo and arrow-key navigation.
Install UI SDK & packages
npm install @ui-sdk/react @ui-sdk/core lucide-react
Give your agent the UI SDK skill
npx skills add vercel-labs/ui --skill ui-sdk
"use client"; import * as React from "react"; import { Check, ChevronLeft, ChevronRight, CircleCheck, CircleX, Clock, Plug, RotateCcw, X, } from "lucide-react"; import { Button } from "@ui-sdk/react/button"; export interface InboxItem { id: string; sender: string; title: string; tag: string; integration?: string; summary: string; body: string; time: string; status: "needs" | "approved" | "skipped"; } const DEFAULT_ITEMS: InboxItem[] = [ { id: "m1", sender: "Launch Agent", title: "Send Day 1 welcome email update to Pace list", tag: "Draft", integration: "ClickFunnels", summary: "Rewrote the opener to remove fluff and verified the download link returns 200.", body: "Subject: Day 1 — Pick one small thing\n\nPick something you can finish before dinner. Reply with the link when it ships.", time: "4m ago", status: "needs", }, { id: "m2", sender: "Support Agent", title: "Reply to Alex about team seat billing", tag: "Lead", integration: "Gmail", summary: "Confirmed prorated seat pricing and drafted a plain 3-line answer.", body: "Hey Alex — adding a second seat is prorated automatically on your existing card. Let me know if you want me to send the invite.", time: "18m ago", status: "needs", }, { id: "m3", sender: "Morning Routine", title: "Daily metrics digest · 14 new signups", tag: "Brief", integration: "Stripe", summary: "Conversion up 1.4% week over week with zero checkout errors.", body: "Signups: 14 (+3)\nCheckout starts: 6\nErrors: 0", time: "1h ago", status: "approved", }, ]; /** * MSAI triage rule: every inbox row is ONE scannable line; opening a message slides a * reading pane over the list so the rows never jump around, with Approve/Skip pinned. */ export function AgentInboxTriage({ initialItems = DEFAULT_ITEMS }: { initialItems?: InboxItem[] }) { const [items, setItems] = React.useState(initialItems); const [openId, setOpenId] = React.useState<string | null>(initialItems[0]?.id ?? null); const openIndex = items.findIndex((i) => i.id === openId); const active = openIndex >= 0 ? items[openIndex] : null; const setStatus = (id: string, status: InboxItem["status"]) => { setItems((prev) => prev.map((it) => (it.id === id ? { ...it, status } : it))); }; return ( <div className="relative overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-lg dark:border-slate-800 dark:bg-[#111827]"> <div className="divide-y divide-slate-200 dark:divide-slate-800"> {items.map((item) => { const unread = item.status === "needs"; return ( <div key={item.id} className={`group flex items-center gap-3 px-4 py-3 text-sm transition hover:bg-slate-50 dark:hover:bg-slate-800/50 ${ unread ? "font-semibold" : "opacity-70" }`} > <button type="button" onClick={() => setOpenId(item.id)} className="flex min-w-0 flex-1 cursor-pointer items-center gap-3 text-left" > <span className="w-28 shrink-0 truncate text-xs text-slate-500">{item.sender}</span> <span className="min-w-0 flex-1 truncate">{item.title}</span> {item.status === "approved" && <CircleCheck className="h-4 w-4 text-emerald-400" />} {item.status === "skipped" && <CircleX className="h-4 w-4 text-slate-400" />} <span className="shrink-0 text-xs font-normal text-slate-400">{item.time}</span> </button> {unread && ( <div className="flex items-center gap-1 opacity-0 transition group-hover:opacity-100"> <button type="button" aria-label={`Quick approve ${item.title}`} onClick={() => setStatus(item.id, "approved")} className="grid h-7 w-7 cursor-pointer place-items-center rounded-lg border border-slate-200 hover:border-emerald-400 hover:text-emerald-400 dark:border-slate-700" > <Check className="h-3.5 w-3.5" /> </button> <button type="button" aria-label={`Skip ${item.title}`} onClick={() => setStatus(item.id, "skipped")} className="grid h-7 w-7 cursor-pointer place-items-center rounded-lg border border-slate-200 hover:border-rose-400 hover:text-rose-400 dark:border-slate-700" > <X className="h-3.5 w-3.5" /> </button> </div> )} </div> ); })} </div> {active && ( <div className="border-t border-slate-200 bg-slate-50/90 p-5 dark:border-slate-800 dark:bg-[#0d1320]"> <div className="flex items-center justify-between gap-2"> <div className="flex items-center gap-2 text-xs"> <span className="font-mono font-semibold text-slate-500">{active.tag}</span> {active.integration && ( <span className="inline-flex items-center gap-1 rounded-full border border-slate-200 bg-white px-2 py-0.5 font-semibold dark:border-slate-700 dark:bg-[#162033]"> <Plug className="h-3 w-3 text-sky-400" /> {active.integration} </span> )} </div> <button type="button" aria-label="Close reading pane" onClick={() => setOpenId(null)} className="grid h-7 w-7 cursor-pointer place-items-center rounded-full hover:bg-slate-200 dark:hover:bg-slate-800" > <X className="h-4 w-4" /> </button> </div> <h3 className="mt-3 text-base font-bold">{active.title}</h3> <p className="mt-1 text-xs text-slate-500 dark:text-slate-400">{active.summary}</p> <pre className="mt-3 whitespace-pre-wrap rounded-xl border border-slate-200 bg-white p-3.5 font-mono text-xs leading-relaxed dark:border-slate-800 dark:bg-[#111827]"> {active.body} </pre> <div className="mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-slate-200 pt-3.5 dark:border-slate-800"> {active.status === "needs" ? ( <div className="flex items-center gap-2"> <Button name="Approve item" onClick={() => setStatus(active.id, "approved")} className="inline-flex h-9 items-center gap-1.5 rounded-lg bg-sky-500 px-3.5 text-xs font-bold text-slate-950" > <Check className="h-3.5 w-3.5" /> Approve </Button> <Button name="Skip item" variant="ghost" onClick={() => setStatus(active.id, "skipped")} className="h-9 rounded-lg border border-slate-300 px-3 text-xs font-semibold dark:border-slate-700" > Skip </Button> </div> ) : ( <div className="flex items-center gap-2 text-xs font-semibold text-emerald-400"> <CircleCheck className="h-4 w-4" /> <span>{active.status === "approved" ? "Approved" : "Skipped"}</span> <Button name="Undo decision" variant="ghost" onClick={() => setStatus(active.id, "needs")} className="inline-flex h-7 items-center gap-1 rounded-md px-2 text-xs text-slate-400 hover:text-white" > <RotateCcw className="h-3 w-3" /> Undo </Button> </div> )} <div className="flex items-center gap-2 text-xs text-slate-400"> <Clock className="h-3.5 w-3.5" /> <span>{active.time}</span> <button type="button" disabled={openIndex <= 0} onClick={() => openIndex > 0 && setOpenId(items[openIndex - 1].id)} className="grid h-7 w-7 cursor-pointer place-items-center rounded-lg border border-slate-700 disabled:opacity-35" > <ChevronLeft className="h-3.5 w-3.5" /> </button> <Button name="Next message" variant="ghost" disabled={openIndex >= items.length - 1} onClick={() => openIndex < items.length - 1 && setOpenId(items[openIndex + 1].id)} className="grid h-7 w-7 place-items-center rounded-lg border border-slate-700 disabled:opacity-35" > <ChevronRight className="h-3.5 w-3.5" /> </Button> </div> </div> </div> )} </div> ); } export default AgentInboxTriage;
More in Dashboard & Data
KPI & Timeframe Telemetry Strip
One framed four-up metric bar (2x2 on tablet, stacked on mobile) with a UI SDK SegmentedControl timeframe switch that updates every number, icon + sign delta pills, tabular numbers, and inline sparklines.
Key-Value Detail Inspector Drawer
Slide-over UI SDK Drawer inspector: semantic <dl> metadata grid, editable status Select and notes Textarea, and a sticky footer with a tactile Copy ID button and a high-contrast Archive record button that confirms in an AlertDialog, then shows the archived state with Restore.
Live Worker & Job Queue Panel
Background job monitor modeled on Template Factory's build workers: live UI SDK Progress bars, Running / Queued / Paused / Done / Failed badges with icons, per-job pause, resume, retry and a Cancel run that confirms in an AlertDialog, a Collapsible log per job, and a queue-wide pause.