Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

Message List

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.

Open in a
new tab
Person person = DataService.getPeople(1).get(0);
MessageList list = new MessageList();
Instant yesterday =
Instant fiftyMinsAgo =
MessageListItem message1 = new MessageListItem(
        "Linsey, could you check if the details with the order are okay?",
        yesterday, "Matt Mambo");
MessageListItem message2 = new MessageListItem("All good. Ship it.",
        fiftyMinsAgo, "Linsey Listy", person.getPictureUrl());
list.setItems(Arrays.asList(message1, message2));

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.

Component Usage recommendations

Message Input

Allow users to author and send messages.