Message

Conversation rows with grouped bubbles that pop in when sent.

Preview

"use client";

import {
  Message,
  MessageAvatar,
  MessageContent,
  MessageFooter,
  MessageGroup,
  MessageHeader,
} from "@/components/agents/message";
import {
  MessageBubble,
  MessageBubbleContent,
} from "@/components/agents/message-bubble";

export function MessageUsage() {
  return (
    <MessageGroup spacing="default">
      <Message from="user" animateIn>
        <MessageAvatar>Y</MessageAvatar>
        <MessageContent>
          <MessageHeader>
            <span>You</span>
            <span>Now</span>
          </MessageHeader>
          <MessageBubble variant="solid">
            <MessageBubbleContent>
              Can you summarize the release notes?
            </MessageBubbleContent>
          </MessageBubble>
          <MessageFooter>Delivered</MessageFooter>
        </MessageContent>
      </Message>

      <Message from="assistant">
        <MessageAvatar>AI</MessageAvatar>
        <MessageContent>
          <MessageHeader>
            <span>Assistant</span>
            <span>Just now</span>
          </MessageHeader>
          <MessageBubble variant="soft">
            <MessageBubbleContent>
              The release improves streaming, navigation, and recovery states.
            </MessageBubbleContent>
          </MessageBubble>
        </MessageContent>
      </Message>
    </MessageGroup>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/message

API Reference

Message

from
"user" | "assistant"

Who sent it; "user" rows align to the end, "assistant" rows to the start.

animateIn?
boolean

Plays a trailing-edge pop-up once when this message row mounts.

Defaultfalse
labels?
Partial<{ user: string; assistant: string; typing: string; }>

Override any built-in string.

className?
string

Classes merged onto the root element.

MessageGroup

spacing?
"compact" | "default"

Gap between messages: 6 px for "compact", 16 px for "default". Default: "compact"

Defaultcompact
className?
string

Classes merged onto the root element.

MessageAvatar

placeholder?
boolean

Keep an empty avatar slot so grouped messages remain aligned.

Defaultfalse
className?
string

Classes merged onto the root element.

MessageContent

className?
string

Classes merged onto the root element.

MessageHeader

className?
string

Classes merged onto the root element.

className?
string

Classes merged onto the root element.

MessageMarker

className?
string

Classes merged onto the root element.

MessageTyping

label?
string

Screen reader text for the typing dots. Default: "Responding"

className?
string

Classes merged onto the root element.

MessageBubble

variant?
"solid" | "soft" | "tint" | "outline" | "ghost" | "danger"

Fill and border style of the bubble. Default: "soft"

Defaultsoft
align?
"end" | "start"

Defaults to the surrounding Message alignment when omitted.

animateIn?
boolean

Plays the bubble entrance once when this component mounts.

Defaultfalse
labels?
Partial<{ showMore: string; showLess: string; }>

Override any built-in string.

className?
string

Classes merged onto the root element.

MessageBubbleCollapsible

open?
boolean

Whether the full text shows, for controlled use.

defaultOpen?
boolean

Whether the full text shows at first when uncontrolled. Default: false

Defaultfalse
onOpenChange?
((open: boolean) => void)

Called with the new state when the text expands or collapses.

collapsedLines?
2 | 6 | 3 | 4 | 5

Lines shown while collapsed. Default: 4

Default4
moreLabel?
ReactNode

Text of the expand button. Default: "Show more"

lessLabel?
ReactNode

Text of the collapse button. Default: "Show less"

contentClassName?
string

Classes merged onto the clamped text wrapper.

triggerClassName?
string

Classes merged onto the show more button.

className?
string

Classes merged onto the root element.

MessageBubbleContent

render?
ReactElement<unknown, string | JSXElementConstructor<any>>

Replaces the content element while preserving bubble styling.

className?
string

Classes merged onto the root element.

MessageBubbleGroup

spacing?
"compact" | "default"

Gap between bubbles. Default: "compact"

Defaultcompact
className?
string

Classes merged onto the root element.

MessageScroller

followOutput?
boolean

Keep streamed output pinned while the reader remains near the end.

Defaulttrue
followThreshold?
number

Distance from the end that still counts as following the output.

Default56
smooth?
boolean

Smoothly follow growing content.

Defaulttrue
onFollowChange?
((following: boolean) => void)

Reports when the reader leaves or returns to the live edge.

label?
string

Accessible label for the scrollable transcript.

busy?
boolean

Marks the transcript as waiting for more streamed content.

navigation?
"rail"

Adds a compact rail for navigating between rendered Message rows.

jumpButton?
boolean

Shows a button back to the latest message once the reader scrolls up. Default true.

Defaulttrue
navigationLabel?
string

Accessible label for the optional message navigation rail.

viewportClassName?
string

Classes merged onto the scrolling viewport.

contentClassName?
string

Classes merged onto the log element that wraps the messages.

railClassName?
string

Classes merged onto the navigation rail, used with `navigation="rail"`.

viewportRef?
Ref<HTMLElement>

Ref to the scrolling viewport element.

viewportProps?
Omit<DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>, "children" | "ref" | "className">

Extra props for the scrolling viewport. Its event handlers still run.

contentProps?
Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "children" | "ref" | "className">

Extra props for the log element that wraps the messages.

labels?
Partial<{ label: string; jumpToLatest: string; navigationLabel: string; preview: string; goToUser: string; goToAssistant: string; goToMessage: string; }>

Override any built-in string.

className?
string

Classes merged onto the root element.

Composition

Build each conversation row from independent identity, content, and metadata primitives.

MessageGroup
└── Message
    ├── MessageAvatar
    └── MessageContent
        ├── MessageHeader
        ├── MessageBubble
        └── MessageFooter

Note: Message Bubble supplies the visual surface inside the row. Message Scroller positions message rows inside a reader-aware transcript. Agent Activity renders progressive agent work as message content.

How it works

A message is a conversation row. It coordinates the avatar, metadata, content surface, and delivery details while allowing the content itself to be a bubble, an agent activity, a tool result, or a composed response.

Also on React Native. Rows that rise out of their corner, with avatars and typing dots.

Updated