Chat & Conversation

Pattern for AI assistant and human conversation interfaces.

Message types

What's the weather like in Tokyo right now?

06:50 PM
06:50 PM

Connected to weather service.

06:50 PM

Streaming

Show a blinking cursor while text streams in.

With input

Help me debug this React component.

I'd be happy to help! Can you share the code?

Sure, here's the stack trace...

ChatMessage props

PropTypeDefaultDescription
role"user" | "assistant" | "system"Who sent the message.
contentReactNodeMessage text or React elements. Strings can stream with the StreamingText component.
streamingbooleanfalseIf true, renders the content with a typewriter cursor.
timestampDateOptional timestamp displayed below the bubble.
avatarReactNodeCustom avatar/icon; defaults to system/user glyph.
actionsReactNodeAction buttons shown on hover (copy, edit, delete).

ConversationContainer props

PropTypeDefaultDescription
messagesMessage[]Array of { id, role, content, timestamp, streaming }.
onScrollBottom() => voidFires when user scrolls to bottom.
showScrollButtonbooleantrueShows floating button.
inputComponentReactNodeOptional fixed input pinned to bottom.
autoScrollbooleantrueScrolls to newest message automatically.

Usage guidelines

  • User messages align right with accent; assistant aligns left.
  • System messages are centered, italicized, and lower opacity.
  • Show copy action on all assistant messages.