Docs

Documentation versions (currently viewingVaadin 25.1 (pre-release))

Message List

Message List allows you to show a list of messages, for example, a chat log.

Message List allows you to show a list of messages, for example, a chat log. You can configure the text content, information about the sender, and the time of sending for each message.

Source code
MessageListComponent.java
message-list-component.tsx
message-list-component.ts

The messages in the list can be populated with the items property. The items property is of type Array, with JSON objects in it. Each JSON object is a single message.

Markdown

Use Markdown formatting in Message List to display rich text instead of plain text.

Markdown syntax gives you rich text formatting with headings, lists, links, and more. You can also use HTML tags within Markdown content. Message List automatically sanitizes content to prevent rendering dangerous HTML.

Source code
MessageListMarkdown.java
message-list-markdown.tsx
message-list-markdown.ts

Attachments

Note
Preview Feature

This is a preview version of Message List Attachments. You need to enable it with the feature flag com.vaadin.experimental.messageListAttachments. Preview versions may lack some planned features, and breaking changes may be introduced in any Vaadin version. We encourage you to try it out and provide feedback to help us improve it.

Messages can include file attachments. Image attachments are displayed as clickable thumbnail previews, while other file types are shown with a file icon and name.

Source code
MessageListAttachments.java
message-list-attachments.tsx
message-list-attachments.ts

Each attachment has a name, a URL, and a MIME type. The MIME type determines how the attachment is rendered: types starting with image/ are shown as thumbnail previews, while all other types are shown as file icons. You can listen for attachment click events to handle downloads or other actions.

Usage for AI Chats

For a higher-level approach that eliminates boilerplate wiring, see the AI support features, which connect Message List and Message Input to an LLM provider automatically.

Combine Message List with Message Input to create effective AI chat interfaces. Build your AI chat interface with:

  • Message List with Markdown formatting to display conversation history

  • Message Input for user interactions

  • Backend service to handle AI interactions

Follow these best practices for a smooth user experience:

  • Append tokens to assistant messages in real time as they arrive

  • Show visual indicators for system activity

  • Preserve conversation history by loading past messages and maintaining session state

Source code
MessageListAiChat.java
screen-reader-only.css
screen-reader-only.css
message-list-ai-chat.tsx
LLMChatService.java
screen-reader-only.css
screen-reader-only.css
message-list-ai-chat.ts
LLMChatService.java
screen-reader-only.css
screen-reader-only.css
Component Usage recommendations

Message Input

Allow users to author and send messages.

Markdown

Standalone component for rendering Markdown content.

EE10DB8E-479C-41D0-9A77-BFA41C340BFB