tinkerers-labs

Message Queue

AI chats

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>
  )
}

Dependencies

More by tinkerers-labs

View all
  • Prompt Input

    Prompt Input

    11
  • Burst

    Burst

    4
  • Notification Stack

    Notification Stack

    1
  • Quantity Button

    Quantity Button

    1
  • Undo Button

    Undo Button

  • Tool Approval

    Tool Approval

  • Swipe Actions

    Swipe Actions

  • Sparkline

    Sparkline

More in AI chats

View all
  • Agent Chat

    Agent Chat

    21
  • AI Suggestions

    AI Suggestions

    27
  • AI Actions

    AI Actions

    372
  • Interactive LLM Token & Context Window Visualizer

    Interactive LLM Token & Context Window Visualizer

    30
  • Aquarium Prompt

    Aquarium Prompt

    223
  • Message Parts

    Message Parts

    11
  • AI SaaS Workflow Hero

    AI SaaS Workflow Hero

    37
  • AI Chat Composer

    AI Chat Composer

    22