Skip to content
Sign upPro
Chat layoutsMini chatMenu

Mini chat (Pro)

ProIncluded in $99

A picture in picture chat over the app: fling it to a corner, move it from the keyboard, or shrink it to a pill that follows the answer.

ProFloating over a shipment page, it shrinks to a pill that follows the answer, moves to another corner and opens again.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/mini-chat

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { MiniChat } from "@/components/ui/chatcn/pro/mini-chat"

<MiniChat
  title="Harbourline assistant"
  messages={messages}
  status={status}
  onSend={send}
  onClose={() => setShown(false)}
/>

It floats over the app so the reader can keep working while they ask. Drag it by its bar and let go: it travels to the nearest corner on the kit's spring, and a quick flick throws it to the corner it was heading for, measured from the pointer's velocity. From the keyboard, focus the bar and use the arrow keys. Shrink it and it becomes a pill that shows the last line of the answer as it arrives (or Answering before the first words), so the reader can follow along without the window in the way; click the pill to open it again. Corners follow the reading direction. placement="contained" keeps it inside its parent.

Examples

States

ProEmpty, answered in another corner, a pill while answering, a pill with the last line, and a failed answer.

Props

PropTypeNotes
messagesChatcnMessage[]The thread, in the kit's message contract
status, error, onStop, onRetry"ready" | "submitted" | "streaming" | "error"Send becomes Stop while it streams; an error offers Try again
value, defaultValue, onValueChangestringThe draft, controlled or not
onSend(text) => void
titleReactNodeOn the bar and in the window's name
corner, defaultCorner, onCornerChange"top-start" | "top-end" | "bottom-start" | "bottom-end"Default bottom end
collapsed, defaultCollapsed, onCollapsedChangebooleanThe pill
onClose() => voidShows a close button
placement"fixed" | "contained"Over the viewport, or inside the parent
disabledboolean
labelsPartial<MiniChatLabels>Every string, for translation

Keyboard

KeyAction
Arrow keys on the barMove to the corner in that direction
EscapeShrink to the pill, focus on the pill
Enter or Space on the pillOpen the window, focus in the input
Enter, Shift EnterSend, new line

Accessibility

  • The window is a non modal dialog, so the app behind it stays usable.
  • The bar is a button that says it moves the window and how to do it from the keyboard.
  • The pill is named by what it opens; its status dot always has the words beside it.
  • Shrinking and opening move focus to the pill and back to the input.

Motion

Moving between corners uses the kit's critically damped spring, so a flick lands without overshoot. While dragging it follows the pointer exactly. Shrinking to the pill animates size and corner radius in 260 ms. Under reduced motion it jumps between corners and sizes.