<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# 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.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

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

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { QueueDock } from "@/components/ouro/queue-dock/queue-dock";
```

## Example

```tsx
<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`.

| Prop | Type | Description |
| --- | --- | --- |
| `className` | `string` | Layout only: margins, width (`mb-2`). Appearance classes warn in development. |
| `items` (required) | `readonly QueuedMessage[]` | The messages waiting, in the order they will be sent. With none the dock renders nothing. |
| `labels` | `QueueDockLabels` | Its words, for apps in other languages. |
| `onEdit` | `((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) | `(id: string) => void` | Called with a message's id when the person presses Remove: take it out of `items`. |
| `onSendNow` | `((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` | `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.

```ts
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;
}
```
