Skip to content

Message

One message in a conversation, with an optional avatar, header and footer.

How do I point www.example.com at my site?
Add the domain under Settings → Domains, then create a CNAME record at your DNS provider that points www.example.com to cname.example.net.
How long does it take to verify?
Usually a few minutes, though some DNS providers take up to an hour.

Installation

  1. Add the registryOnce per project
  2. Add message

Usage

align="end" places a message on the opposite side, for the person's own messages. A bubble is as wide as its text, up to 80% of the message's width. A ghost bubble fills the full width. Long words and links wrap inside the bubble.

MessageBubble preserves the line breaks in its text, so a message shows as the person typed it. Render an assistant's reply with Markdown in place of the bubble. Markdown fills the message's width, as a Trace or Tool does.

Composition

Examples

Variants

Default, for most messages.
Primary, to set your own apart.
Outline, for quieter asides.
Destructive, for a message that failed.
Ghost has no frame and fills the width, for an assistant’s replies.

With an avatar

MessageAvatar holds an Avatar and centers it on the message's first line, however long the message runs. That's the MessageHeader, which names the sender above the bubble, or else the first line of the bubble or reply.

AP
Ada Park
The staging deploy is green. Want me to promote it?
TS
Tony Stark
Yes, ship it.

Grouped

MessageGroup brings one sender's messages closer together. Put the avatar on the last message, and give the others an empty MessageAvatar so their bubbles line up with it.

Sam Rivera
Quick update on the launch.
The docs are live and the changelog goes out at noon.
SR
Shout if anything looks off.

With actions

MessageFooter holds actions such as a Copy Button. ghost buttons in the footer render their icons in the muted icon color, and an xs or icon-xs button at the edge aligns its icon with the edge of the message. Give icon-only actions an aria-label. To keep an action pending while it runs, return a promise from its onClick.

How do I point www.example.com at my site?
Add the domain under Settings → Domains, then create a CNAME record at your DNS provider that points www.example.com to cname.example.net. Verification usually finishes within a few minutes.

Failed

When a reply fails, say so in a destructive bubble with role="alert", so screen readers announce it, and offer a way to try again in its footer.

Summarize this week’s incidents.

With a trace

An assistant's message can show the steps it took with a Trace above its reply.

Is example.com’s certificate about to expire?
Looked up example.com’s certificate0.4sChecked the certificate chain
No. It was renewed on March 2 and is valid until June 1, so there’s nearly three months left. Renewal is automatic.

Props

Base UI's styling (opens in a new tab) and composition (opens in a new tab) guides say more about className, style and render.

MessageGroup

Message

MessageAvatar

MessageContent

MessageHeader

MessageBubble

MessageFooter