Chat Messages, animated React component
A chat thread styled like a messaging app, with blue user bubbles, grey replies and a composer. With autoplay the conversation plays itself: user lines type into the composer and pop out, and the assistant's typing dots grow into each reply; visitors can then send their own messages. Also includes Composer Morph Chat, where the text in the composer lifts out of the field and morphs into the sent bubble, then the reply shimmers and streams in word by word. Also includes Chat Head, a chat that lives in a draggable floating head that flings to the nearest edge, peeks new messages, opens into a panel and can be dismissed on a target or with the keyboard.
- Free
- AI Components
- Spring
Types with a key click for every character, in sync with the text. The click stays off until you switch it on.
Chat Messages
Composer Morph Chat
Chat Head
Like Chat Messages? 256 more are in Pro.
Pro unlocks all 256 Pro components, every template and block, and everything we release next. Chat Messages stays free.
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Nexus AI
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| messages | ChatMessage[] | 5-message demo | The conversation: { id, sender: "user" | "assistant", content, timestamp? }. |
| autoplay | boolean | false | Plays the conversation and loops it until someone touches the chat. `autoPlay` still works. |
| autoPlayDelay | number | 900 | Pause after each message during autoplay, in ms. |
| typingDuration | number | 1300 | How long the typing dots show before a reply, in ms. |
| showReplay | boolean | true | Shows a replay button in the header. |
| interactive | boolean | true | Lets visitors type and send their own messages. |
| reply | (text: string) => string | Promise<string> | — | Produces the assistant's answer to a sent message. Defaults to canned replies. |
| onSend | (text: string) => void | — | Called with the text whenever the visitor sends a message. |
| title | string | "Nexus AI" | Name in the header. |
| className | string | — | Extra classes for the root. Give it a height to change the default 440px. |
| ComposerMorphChat.autoplay | boolean | false | Types two scripted questions into the composer and sends them, once, until someone touches the chat. Waits until the chat is on screen and never runs under reduced motion. |
| ComposerMorphChat.onSend | (text: string) => void | undefined | Called with the text of every message the visitor sends. Replies are canned demo text and nothing is sent over the network. |
| ComposerMorphChat.className | string | undefined | Extra classes for the chat card, which is 380px wide at most and 520px tall. |
| ChatHead.autoplay | boolean | false | Bounces the head, peeks new messages and drifts it between the edges until someone touches the stage. Pauses off screen and never runs under reduced motion. |
| ChatHead.name | string | "Maya" | Name shown on the head, in the message peek and in the panel header. |
| ChatHead.onReply | (text: string) => void | undefined | Called with the text of a quick reply when the visitor taps one. |
| ChatHead.onDismiss | () => void | undefined | Called when the head is dropped on the target or dismissed with the Delete key. |
| ChatHead.className | string | undefined | Extra classes for the stage. The stage is its own bounded box, 360px wide at most and 540px tall, and the head never leaves it. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry
Run this once per project. It writes the Nexus UI entry into
components.jsonfor you:npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"Type it exactly as shown.
{name}is filled in by the CLI with the component you ask for, so you never replace it.
- 3
Add the component
Run this from your project root. It adds the component, the helpers it imports and its npm packages.
npx shadcn@latest add @nexus-labs/chat-messages
- 4
Check what was added
With a project made as in the Quick Start (a
src/folder), these files land in it:components/chat-messages/chat-head.tsxchat-messages.tsxcomposer-morph-chat.tsxindex.ts - 5
Copying by hand? Skip the registry
Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that
cn()exists. Install the packages:npm install framer-motion
Then show the source and create each file at the path it gives:
- 6
Use it in a page
Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:
// src/app/page.tsx import { ChatMessages } from "@/components/chat-messages"; export default function Page() { return ( <main> <ChatMessages /> </main> ); }
Like Chat Messages? 256 more are in Pro.
Pro unlocks all 256 Pro components, every template and block, and everything we release next. Chat Messages stays free.
About Chat Messages
Chat Messages renders animated conversation bubbles with typing indicators and sequential message reveal. Messages enter one by one with Framer Motion spring animations, simulating a real-time conversation at configurable speed. Typing indicator dots appear between message groups. Use it in AI product demos to show a sample conversation without a live backend, or in chat application showcases to demonstrate the conversational UI design.
Good for
- AI product and chatbot demos
- Customer support tool feature sections
- Conversational UI mockups and showcases
- Messaging app landing pages
Chat Messages questions
How do I install the Chat Messages component?
Run `npx shadcn@latest add @nexus-labs/chat-messages`. It adds chat-messages.tsx to your project and uses framer-motion and lucide-react.
How do I show my own conversation?
Pass a `messages` array of `{ id, sender: "user" | "assistant", content }` objects. Assistant messages show the typing dots for `typingDuration` ms before they appear, and `autoPlayDelay` sets the gap between messages.
Can visitors type into the chat?
Set `interactive` to true to enable the input; Enter sends the message. The reply is a fixed placeholder, so connect the send handler to your own API for a real chatbot. By default it runs as a demo with a replay button (`showReplay`).
Does it work with the Next.js App Router?
Yes. The file starts with "use client", so you can render it from a server page. The message list uses role="log" with aria-live so screen readers announce new messages.