Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

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

Online

Props

PropTypeDefaultWhat it does
messages5-message demoThe conversation: { id, sender: "user" | "assistant", content, timestamp? }.
autoplayfalsePlays the conversation and loops it until someone touches the chat. `autoPlay` still works.
autoPlayDelay900Pause after each message during autoplay, in ms.
typingDuration1300How long the typing dots show before a reply, in ms.
showReplaytrueShows a replay button in the header.
interactivetrueLets visitors type and send their own messages.
reply—Produces the assistant's answer to a sent message. Defaults to canned replies.
onSend—Called with the text whenever the visitor sends a message.
title"Nexus AI"Name in the header.
className—Extra classes for the root. Give it a height to change the default 440px.
ComposerMorphChat.autoplayfalseTypes 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.onSendundefinedCalled with the text of every message the visitor sends. Replies are canned demo text and nothing is sent over the network.
ComposerMorphChat.classNameundefinedExtra classes for the chat card, which is 380px wide at most and 520px tall.
ChatHead.autoplayfalseBounces 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"Maya"Name shown on the head, in the message peek and in the panel header.
ChatHead.onReplyundefinedCalled with the text of a quick reply when the visitor taps one.
ChatHead.onDismissundefinedCalled when the head is dropped on the target or dismissed with the Delete key.
ChatHead.classNameundefinedExtra 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. 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 creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry

    Run this once per project. It writes the Nexus UI entry into components.json for 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.

  1. 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
  2. 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.tsx
    chat-messages.tsx
    composer-morph-chat.tsx
    index.ts
  3. 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:

  4. 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.

Guides