Message
Displays a message in a conversation, with optional avatar, header, footer, and alignment.
Note: The Message component is a fully custom implementation with no external dependencies.
The Message component lays out a single message in a conversation. It handles the avatar, alignment, header, and footer around the message surface.
For AI apps, you can render reasoning steps, tool calls and assistant messages using the Message component.
Installation
Copy the following code into your app directory.
Command
Command
Manual
Manual
uv
Note: Message owns the row layout—avatar, alignment, header, and footer. Render the visible message surface inside it with Bubble. For the scroll container around a conversation, use MessageScroller.
Anatomy
Use the following composition to build a Message component.
Examples
Avatar
Use message.avatar to render an avatar next to the message. Set align="end" on the message to align the avatar to the end of the message.
Group
Use message.group to stack consecutive messages from the same sender. Render an empty message.avatar on the earlier messages to keep them aligned with the avatar on the last one.
Header and Footer
Use message.header for a sender name and message.footer for metadata such as a delivery or read status.
Actions
Place message-level actions in message.footer, such as copy, retry, or feedback buttons.
Attachment
Use the Attachment with the messages to displays a file or image attachment with media, metadata, upload state, and actions.
Accessibility
Message is a presentational layout wrapper. Accessibility comes from the content you place inside it.
Label icon-only actions
Action buttons in message.footer are usually icon-only, so give each one an aria-label.
python
Status updates
For in-progress messages, use a Marker with role="status" so assistive tech announces the update as it appears.
python
API Reference
message.root
The message row wrapper.
message.group
Groups consecutive messages from the same sender.
message.avatar
The avatar slot, aligned to the bottom of the message. When the message has a message.footer, the avatar shifts up to stay aligned with the message surface instead of the footer.
message.content
Wraps the header, message surface, and footer.
message.header
Displays content above the message, such as a sender name. Stays aligned to the start regardless of align.
message.footer
Displays content below the message, such as status or actions. Aligns to the message side.