Quick ChatPro

A ready-made AI chat panel. It floats, docks to the side, fills the page or shrinks to a bar, and comes with mentions, a model picker, file uploads, voice input, chat history and streaming replies.

Preview

Open it on its own page ↗

Usage

1. Put it on the page

Place it inside a box with position: relative. That's all you need to see it working; it answers with a sample reply until you connect your own AI.

Example
import { QuickChat } from "@/components/ui/quick-chat"

export function Page() {
  return (
    <div className="relative h-svh">
      <QuickChat />
    </div>
  )
}

2. Connect your AI

Pass onSend. It gets the message and returns the answer. Return plain text, or text with the tools your agent used:

Example
<QuickChat
  onSend={async (text, { model }) => {
    const res = await fetch("/api/chat", { method: "POST", body: JSON.stringify({ text, model }) })
    const data = await res.json()
    return { text: data.answer, tools: ["Searched customers"] }
  }}
/>

3. Stream the answer (optional)

To show words as your server sends them, return an async generator. Pass signal to fetch so the Stop button really cancels the request.

Example
async function* answer(text: string, { history, model, signal }: QuickChatSendContext) {
  const res = await fetch("/api/chat", { method: "POST", body: JSON.stringify({ text, history, model }), signal })
  const reader = res.body!.pipeThrough(new TextDecoderStream()).getReader()
  while (true) {
    const { value, done } = await reader.read()
    if (done) return
    yield value
  }
}

<QuickChat onSend={answer} />

4. Open and close it from a button

Example
const [open, setOpen] = useState(false)

<button onClick={() => setOpen(true)}>Quick Chat</button>
<QuickChat open={open} onOpenChange={setOpen} />

Layouts

The layout button in the header switches between four layouts. You can also set one with defaultLayout or control it with layout and onLayoutChange.

LayoutWhat it looks like
popupA floating card in the top right. Drag its bottom-left corner to resize.
drawerA full-height panel on the right. Drag its left edge to resize.
fullFills the whole box.
minimizedJust the header, in the bottom right. Click it to bring the chat back.

For the drawer to push your content aside instead of covering it, put the chat next to your content in a flex row:

Example
<div className="relative flex h-svh">
  <main className="min-w-0 flex-1">{/* your app */}</main>
  <QuickChat defaultLayout="drawer" />
</div>

Chat history

The clock button in the header opens History: every chat, newest first, grouped by day. Each one shows its full date and time (for example "Oct 26, 2026 · 2:30 AM"), so chats with similar names are easy to tell apart. People can:

  • Search by any word in a chat. Matches are highlighted.
  • Filter by date with Any time, Today, 7 days or 30 days.
  • Click a chat to carry on with it, or press the bin to delete it.

Chats save on their own as people talk. To keep them after a reload, give a storageKey and they're stored in the browser:

Example
<QuickChat storageKey="my-app-chats" />

To save them on your server instead, start from defaultHistory and listen with onHistoryChange:

Example
<QuickChat defaultHistory={savedChats} onHistoryChange={(chats) => saveChats(chats)} />

The header shows the chat's first message as its name. Long names stop after 12 words with "…"; hover over the name to read all of it.

What people can do in the composer

  • @ tags an agent or teammate. Typing @ opens the list too.
  • Model picks which model answers, and its menu has an Extended thinking switch. Both reach you in onSend as model and thinking.
  • + attaches files. Pasting or dropping files works too.
  • Mic types what they say, where the browser supports speech. Press it again to keep the words, or ✕ to throw them away.
  • Stop cancels a reply that's still coming. Retry asks again.

Pass your own lists with mentions and models, or [] to hide a button. The sample lists use plain line icons in neutral tiles; add a color to an item if you want it tinted.

Props

PropTypeDefaultWhat it does
onSend(text, context) => replysample replyAnswers a message. Return text, { text, tools }, or a stream.
agentNamestring"Rune"Name shown on the welcome screen.
descriptionstring—Line under the welcome heading.
placeholderstring—Placeholder text in the message box.
suggestionsstring[]3 promptsStarter buttons on the welcome screen. [] hides them.
open / defaultOpen / onOpenChangebooleantrueShow or hide the panel.
layout / defaultLayout / onLayoutChange"popup" | "drawer" | "full" | "minimized""popup"How the panel sits on the page.
mentionsMention[]sample listAgents and people for @.
models / defaultModelModelOption[] / stringsample list / firstModels in the picker, and which one starts picked.
defaultThinkingbooleanfalseStart with Extended thinking on.
defaultHistoryQuickChatSession[][]Past chats to show in History.
onHistoryChange(chats) => void—Called when a chat is saved or deleted.
storageKeystring—Keep history in the browser under this key.
attachmentsbooleantrueAllow file uploads.
dictationbooleantrueShow the mic where the browser supports it.
closablebooleantrueShow the close button and close on Escape.

onSend receives (text, context). The context has history (earlier messages), model, thinking (whether Extended thinking is on), attachments (the files) and signal (aborted on Stop, New chat or close).

Accessibility

  • Escape closes the open menu first, and the panel only when no menu is open
  • Every button is labeled, and menus work with the arrow keys, Enter and Escape
  • Finished replies are read out to screen readers once, not word by word
  • The resize grips work with the arrow keys too
  • With reduced motion, replies appear without the blur and the panel fades instead of sliding