Skip to content
Haze UI

AI human handoff

In-chat escalation card with live queue countdown, shared context summary, support avatar stack, cancel option, and specialist join state.

pnpm dlx shadcn@latest add @haze/ai-handoff
Open preview in a new tab
Livesmall script

When to use

  • Transferring an AI support thread to a human billing or account specialist with visible queue progress
  • Showing users the exact account facts shared with the incoming agent for transparency
  • Allowing users to cancel escalation and stay with the AI assistant before a specialist connects

When not to use

  • Presenting a general multi-turn AI chat interface without live queue escalation; use ai-chat or chat-thread
  • Connecting an external API integration or OAuth workspace rather than a human agent; use ai-connect

Installation

Add the Haze registry to components.json once, then install AI human handoff with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/ai-handoff
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
idstring"haze-ai-handoff"Unique prefix for the section heading and aria-labelledby reference.
headingstring"Human specialist handoff"Screen-reader section heading for landmark navigation.
userPromptstring"I got charged twice for October"User message triggering escalation to a human specialist.
assistantReplystring"I can see both charges. Refunds need someone on the billing team..."Assistant reply confirming escalation and context transfer.
departmentstring"Billing"Target support queue name displayed in the card header.
specialistNamestring"Tessa"Name of the human specialist who joins when the queue reaches zero.
specialistRolestring"Billing specialist"Role subtitle shown on the specialist arrival banner.
specialistMessagestring"Hi! I can see both $24.00 charges on INV-2291..."Opening message from the human specialist after joining.
waitEstimatestring"Usually replies in about 2 min"Typical response wait estimate displayed beside the team initials stack.
contextItemsstring[]3 factual account summary itemsBullet points explaining what context is passed to the human specialist.
teamInitialsstring[]["N", "T", "A"]Support team initials rendered in the overlapping avatar stack.
classstring–Extra classes on the outer section.

Keyboard interactions

Tab
Move to Keep chatting with AI during queuing, Rejoin queue when paused, or Replay handoff once connected
EnterSpace
Cancel escalation, rejoin the billing queue, or replay the live specialist handoff

Accessibility

  • Queue position updates (3rd, 2nd, 1st, Connected), cancellations, and specialist arrival are announced politely through a dedicated role="status" live region.
  • Cancelling handoff or rejoining the queue keeps keyboard focus on the next available action without trapping or losing focus.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI block "AI human handoff" with `npx shadcn@latest add @haze/ai-handoff`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AiHandoff from "@/components/haze/blocks/ai-handoff.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/ai-handoff.md

  • Customize with real content

    Adapt the Haze ai-handoff block for our product. Replace the demo values of these props with our real content: id, heading, userPrompt, assistantReply, department, specialistName, specialistRole, specialistMessage, waitEstimate, contextItems, teamInitials, class. Keep the layout, the heading level rules and these accessibility details: Queue position updates (3rd, 2nd, 1st, Connected), cancellations, and specialist arrival are announced politely through a dedicated role="status" live region. Cancelling handoff or rejoining the queue keeps keyboard focus on the next available action without trapping or losing focus. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using ai-handoff, check it fits: use it when transferring an ai support thread to a human billing or account specialist with visible queue progress; showing users the exact account facts shared with the incoming agent for transparency; allowing users to cancel escalation and stay with the ai assistant before a specialist connects. Avoid it when presenting a general multi-turn ai chat interface without live queue escalation; use ai-chat or chat-thread; connecting an external api integration or oauth workspace rather than a human agent; use ai-connect. Alternatives: @haze/ai-chat, @haze/ai-connect, @haze/chat-thread.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog