Skip to content
UI
On this page

Message

Displays conversation messages with optional avatars, headers, and footers.

Overview

Copy the source into your project. Import the parts that you need. Styles use local StyleX declarations and shared theme tokens. You can change the source without a wrapper or replacement package.

Preview

Basic conversation

Installation

Run the init command from your project root first. The CLI configures StyleX and installs shared files and dependencies.

Run from your project root. The CLI installs required components, shared files, and packages. Previews may need additional components. The CLI keeps existing files.

Usage

Use align="end" for outgoing messages. The default is logical start. Both values follow the text direction.

Put MessageAvatar before MessageContent. Use AvatarImage before AvatarFallback inside Avatar. Leave MessageAvatar empty to align earlier grouped rows.

Use MessageGroup for consecutive messages from one sender. Put MessageHeader and MessageFooter inside MessageContent.

Use MessageHeader for the sender name. Use MessageFooter for delivery status or message actions.

Compose the message body with Text, Box, or Card. Message does not add a bubble. Use the accent-solid color pair for sent bubbles.

Install Box separately for the usage example.

Use alternative text for an informative image. Use a named link for each downloadable attachment.

Give icon-only actions accessible names. Use role="status" for progress updates that need an announcement.

Import from the local file installed by the CLI.

Examples

Copy the example you want to use. Copy the shared source into the same directory.

Avatar

Place AvatarImage before AvatarFallback. Use logical start for received messages and logical end for sent messages.

Group

Group consecutive messages from one sender. Leave the earlier avatar slots empty to keep the messages aligned.

Put the sender name and time in MessageHeader. Put delivery or read status in MessageFooter.

Actions

Place copy, reaction, and retry buttons in MessageFooter. Give each icon-only button an accessible name.

Attachment

Put images and files in MessageContent. Give informative images alternative text. Name each download link.

Status updates

Give progress updates a text label. Use a status region to announce updates to assistive technology.

Shared example source

Save this file as message-demo-parts.tsx.

API reference

The generator reads the component TypeScript source. Only component and Base UI props appear below. The Required column shows whether you must supply a property. It does not mean you must use the component.

View API reference