Skip to main content

Chat

QueueDock

The messages a person typed while their agent was busy, waiting above the Composer to go next, in order. Each is shown in full, with Edit, Send now and Remove; your app does what each says and updates items. A screen reader hears the count when it changes, "2 messages queued", and "No messages queued" when the last one leaves. When a message leaves while one of its buttons holds focus, focus moves to the next message's buttons, or to the Composer under the dock when it was the last. Edit, Send now and Remove are the person's alone: its agent side, queueDockAx, declares them person-only, so no agent door offers them.

2 messages queued

  1. Make one of them vegetarian, please.

  2. And keep everything under 40 minutes.

Install

Hand it to your agent
Add QueueDock from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/queue-dock.md first and follow it.

Or by hand. Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823

Then the component (Installing):

npx shadcn@latest add ourostack/ouro-ui/queue-dock#v1.3.823
import { QueueDock } from "@/components/ouro/queue-dock/queue-dock";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

<QueueDock items={queued} onEdit={editQueued} onSendNow={sendNow} onRemove={unqueue} />
<Composer label="Message your agent" onSend={(text) => (busy ? queue(text) : send(text))} />

Use instead when

  • Use Composer's quote instead for a message the person is replying to, and MessageList for messages already sent.

Props

Type: QueueDockProps.

className
Type: string
Layout only: margins, width (mb-2). Appearance classes warn in development.
items (required)
Type: readonly QueuedMessage[]
The messages waiting, in the order they will be sent. With none the dock renders nothing.
labels
Type: QueueDockLabels
Its words, for apps in other languages.
onEdit
Type: ((id: string) => void)
Called with a message's id when the person presses Edit. Take it out of items, so it can't be sent while they edit it, put its text in your Composer after any draft there, and focus the Composer; sending it queues it again at the end. Without it there is no Edit.
onRemove (required)
Type: (id: string) => void
Called with a message's id when the person presses Remove: take it out of items.
onSendNow
Type: ((id: string) => void)
Called with a message's id when the person presses Send now: send it at once, without waiting for the agent's turn to end, and take it out of items. Without it there is no Send now.
ref
Type: Ref<HTMLElement>
Reaches the rendered element.

Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

  • messages: Not a prop. The queued messages are items: <QueueDock items={[{ id, text }]}>.
  • onCancel: Not a prop. Ouro UI uses onRemove: <QueueDock onRemove={(id) => unqueue(id)}>.
  • onDelete: Not a prop. Ouro UI uses onRemove: <QueueDock onRemove={(id) => unqueue(id)}>.
  • onSteer: Not a prop. Sending one at once is onSendNow: <QueueDock onSendNow={(id) => sendNow(id)}>.
  • queue: Not a prop. The queued messages are items: <QueueDock items={[{ id, text }]}>.

className is for layout only

Pass margins, width and grid placement (mt-4, w-full, col-span-2).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (hover:, sm:) and any ! are removed, it starts with bg-, text-, border-, rounded-, shadow-, font-, ring-, from-, via-, to-, fill- or stroke-, or is border, rounded, shadow or ring, or has a dark: variant. Text wrapping, overflow and table layout classes (text-wrap, text-ellipsis, border-collapse) are layout and do not warn.

Alignment classes (text-center) warn too: set alignment on a parent element.

Types

QueuedMessage

One message the person queued for their agent.

interface QueuedMessage {
  /** Your app's id for it, passed back to `onEdit`, `onSendNow` and `onRemove`. */
  id: string;
  /** What the person wrote, as plain text. The dock shows it in full, line breaks kept. */
  text: string;
}