Chat Conversation

Scrolling chat transcript built on Message Scroller: a polite live log that follows the streaming edge, with turn, attribution, pulsing cursor and shimmering status parts.

Open the preview in a new tab

The source comes with full access.

One payment of $149 opens the source right here and lets the CLI install every paid component, with lifetime updates.

Installation

pnpm dlx shadcn add @01orbital/chat-conversation
npx shadcn add @01orbital/chat-conversation
yarn shadcn add @01orbital/chat-conversation
bunx --bun shadcn add @01orbital/chat-conversation

Part of the 01orbital library. With a license, put ORBITAL_TOKEN in .env.local and the same command installs it (licensed install, pricing).

It lands at components/chat/chat-conversation.tsx, as source you own and edit.

The example also uses chat-message and chat-response. Install them too:

pnpm dlx shadcn add @01orbital/chat-message @01orbital/chat-response
npx shadcn add @01orbital/chat-message @01orbital/chat-response
yarn shadcn add @01orbital/chat-message @01orbital/chat-response
bunx --bun shadcn add @01orbital/chat-message @01orbital/chat-response

Usage

"use client"

import {
  ChatConversation,
  ChatConversationContent,
  ChatConversationCursor,
  ChatConversationStatus,
  ChatConversationTurn,
} from "@/components/chat/chat-conversation"
import { ChatMessage } from "@/components/chat/chat-message"
import { ChatResponse } from "@/components/chat/chat-response"

// Every word on the page. Change copy here, not in the markup.
const COPY = {
  body: "Which hero should I use for a product page?",
  body2:
    "hero-108 is the flagship — an app frame on the house ground. For a type-led page, hero-109 keeps it minimal.",
  body3: "And for a pricing page?",
  body4: "Pair it with three-plan-pricing-01 and keep one display size",
  label: "Thinking",
} as const

export default function ChatConversationDemo() {
  return (
    <div className="grid min-h-full w-full max-w-xl flex-1">
      <ChatConversation className="px-4 py-4">
        <ChatConversationContent className="gap-6">
          <ChatConversationTurn messageId="usr-1" scrollAnchor>
            <ChatMessage variant="mine">{COPY.body}</ChatMessage>
          </ChatConversationTurn>
          <ChatConversationTurn messageId="asst-1">
            <ChatResponse
              className="text-sm/7 text-foreground"
              text={COPY.body2}
            />
          </ChatConversationTurn>
          <ChatConversationTurn messageId="usr-2" scrollAnchor>
            <ChatMessage variant="mine">{COPY.body3}</ChatMessage>
          </ChatConversationTurn>
          <ChatConversationTurn messageId="asst-2" pending>
            <ChatResponse
              className="text-sm/7 text-foreground"
              text={COPY.body4}
            >
              <ChatConversationCursor />
            </ChatResponse>
          </ChatConversationTurn>
          <ChatConversationTurn messageId="status">
            <ChatConversationStatus>{COPY.label}</ChatConversationStatus>
          </ChatConversationTurn>
        </ChatConversationContent>
      </ChatConversation>
    </div>
  )
}

Anatomy

Chat Conversation is built from 6 parts. In the example they nest like this:

ChatConversation
└─ ChatConversationContent
   └─ ChatConversationTurn
      ├─ ChatConversationCursor
      └─ ChatConversationStatus
  • ChatConversation: The scrolling transcript of a chat. It follows new messages as they stream in, stops following when the reader scrolls up, and shows a button to jump back to the latest message while they are away from it. Screen readers hear it as a polite live log.
  • ChatConversationContent: The column that holds the turns, inside ChatConversation.
  • ChatConversationTurn: One turn of the conversation: a message from the person or a reply from the assistant.
  • ChatConversationCursor: A blinking block at the end of a reply that is still streaming. Hidden from assistive tech; it stops blinking when reduced motion is on.
  • ChatConversationStatus: A short status line under a turn, such as "Thinking". Screen readers announce it politely; its shimmer stops when reduced motion is on.
  • ChatConversationAttribution: The sender's name, and optionally the time, above a turn, set on a thin rule.

API reference

ChatConversation

The scrolling transcript of a chat. It follows new messages as they stream in, stops following when the reader scrolls up, and shows a button to jump back to the latest message while they are away from it. Screen readers hear it as a polite live log.

className lands on the scrolling viewport, so padding scrolls with the messages.

It accepts the props of the shadcn part it wraps, and the HTML attributes of the element it renders.

ChatConversationContent

The column that holds the turns, inside ChatConversation.

It accepts the props of the shadcn part it wraps, and the HTML attributes of the element it renders.

ChatConversationTurn

One turn of the conversation: a message from the person or a reply from the assistant.

Prop

Type

It also accepts the props of the shadcn part it wraps, and the HTML attributes of the element it renders.

ChatConversationCursor

A blinking block at the end of a reply that is still streaming. Hidden from assistive tech; it stops blinking when reduced motion is on.

It accepts the HTML attributes of the element it renders.

ChatConversationStatus

A short status line under a turn, such as "Thinking". Screen readers announce it politely; its shimmer stops when reduced motion is on.

It accepts the HTML attributes of the element it renders.

ChatConversationAttribution

The sender's name, and optionally the time, above a turn, set on a thin rule.

It is hidden from assistive tech and can't be selected, so the name and time never get copied along with a message.

Prop

Type

It also accepts the props of the Base UI part it wraps, and the HTML attributes of the element it renders.

Dependencies

npm: cn. The CLI installs them for you.

Registry pieces it installs with it:

  • font-geist-mono
  • marker
  • message-scroller

On this page