About
Keeps follow-ups typed while the agent is busy. They stack above the composer, can be edited, reordered or removed, and go out one at a time when the agent is free.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Message Queue to your project and fits it to your theme.
Code
How Message Queue is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client"
import * as React from "react"
import {
MessageQueue,
type QueuedMessage,
} from "@/components/ui/mischief-message-queue"
const initialQueue: QueuedMessage[] = [
{ id: "q1", text: "Then run the migration against the staging database." },
{ id: "q2", text: "Keep the old column until the backfill finishes." },
]
export default function MessageQueueDemo() {
const [busy, setBusy] = React.useState(true)
const [queue, setQueue] = React.useState(initialQueue)
const [sent, setSent] = React.useState<string[]>([
"Add a nullable email column to the users table.",
])
React.useEffect(() => {
if (!busy) return
const timer = window.setTimeout(() => setBusy(false), 4000)
return () => window.clearTimeout(timer)
}, [busy])
const send = (text: string) => {
setSent((current) => [...current, text])
setBusy(true)
}
return (
<div className="grid w-full max-w-xl gap-3">
<ol aria-label="Sent messages" className="grid gap-1.5">
{sent.slice(-3).map((text, index) => (
<li
className="bg-muted text-foreground justify-self-end rounded-[var(--radius)] px-3 py-2 text-sm"
key={`${index}-${text}`}
>
{text}
</li>
))}
</ol>
<p className="text-muted-foreground text-xs" role="status">
{busy ? "The agent is working." : "The agent is idle."}
</p>
<MessageQueue
busy={busy}
items={queue}
onItemsChange={setQueue}
onRelease={(item) => send(item.text)}
/>
</div>
)
}
















