Skip to content
VenusUI
Get started

Chat Thread

A messaging conversation that plays out with typing indicators; viewers can send replies too.

Preview

Installation

npx shadcn@latest add @venusui/chat-thread

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/chat-thread.tsx

Usage

The code behind the preview above.

chat-thread-demo.tsx

import { ChatThread } from "@/components/ui/chat-thread"

// Portrait: Unsplash (free under the Unsplash License). The people are made up.
export default function ChatThreadDemo() {
  return (
    <ChatThread
      className="w-[min(22rem,calc(100vw-3rem))]"
      contact={{
        name: "Sofie Lindqvist",
        status: "online",
        avatar: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=96&h=96&fit=crop&crop=faces&auto=format&q=80",
      }}
      messages={[
        { id: "1", from: "them", text: "Are we still on for the design review tomorrow?" },
        { id: "2", from: "me", text: "Yes! 10 am in 4B." },
        { id: "3", from: "me", text: "I’ll bring the new onboarding screens." },
        { id: "4", from: "them", text: "Perfect. Can you add the empty states too? 🙏" },
      ]}
      replies={["Amazing, thank you!", "Haha, sounds good 😄", "See you then!"]}
    />
  )
}

API reference

PropTypeDefaultDescription
contact{ name: string; avatar?: string; status?: string }—Shown in the header.
messages{ id: string; from: "me" | "them"; text: string }[]—The conversation so far.
repliesstring[]—Answers the contact gives, in turn, when the viewer sends a message.
autoplaybooleantruePlay the conversation out message by message.

All <div> props; className sizes it (30rem tall by default).

Requirements

  • lucide-react for the send icon. React 19 and Tailwind CSS v4.

Customization

  • It's a demo conversation, not a chat client. For a real one, render your messages and send them from the form's submit handler.

Accessibility

  • Messages are a log region, so new ones are announced, each prefixed with who sent it.
  • The typing indicator has text for screen readers; the message field has a label.
  • With reduced motion the conversation shows at once.

Troubleshooting

Emoji look different from the preview.
Emoji are drawn by the visitor's operating system.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

Analog Clock

Data display

A station clock whose needle waits at twelve; drag the minute hand to set it by hand.

Loading preview

Bookshelf

Interactive

Books on a wooden shelf whose spines lift on hover and pull out when selected, with a matching cover.

Loading preview

Keyboard

Interactive

A compact Mac-style keyboard whose keys press down when clicked, light up as you type on your own keyboard, and can sound like a mechanical keyboard.