1Sponsor

Chat Message

Chat message bubble with role label, streaming indicator, and collapsible content

Terminal

Installation

pnpm dlx shadcn@latest add https://termcn.dev/r/chat-message.json

Usage

import { ChatMessage } from "@/components/ui/chat-message";
<ChatMessage sender="assistant" name="Claude" timestamp={new Date()}>
  Here is the refactored version of your function.
</ChatMessage>

API Reference

ChatMessage

PropTypeDefault
sender"user" | "assistant" | "system" | "error"required
namestringundefined
timestampDateundefined
streamingbooleanfalse
collapsedbooleanundefined
childrenReactNodeundefined