Create

General

Message

Copy page View as Markdown Open in ChatGPT Open in Claude

One message of a conversation: an avatar, a name and time, bubbles, files and a status line.

Usage#

app.component.ts
import { WDS_MESSAGE } from '@wds/angular/message';

The text goes in Bubble, files in Attachment, and a scrolling thread in Message Scroller.

Examples#

Default#

align="end" mirrors the user's own messages.

Is the 18:05 to Poznań on time? Yes, departing from platform 3. Perfect, see you on board.

Avatars#

wds-message-avatar sits at the bottom of the message, next to the last bubble.

AN I left my backpack on the 9:12 from Wrocław, coach 5, near the door. It is black with a red keychain. PZ Found it. You can pick it up at the lost property office in Poznań.

wds-message-header holds the name and time, wds-message-footer the delivery status or edits. Separate parts with a decorative dot hidden from screen readers.

Anna Nowak 09:38 The seat map shows coach 7 twice. Fixed, it was a duplicate in the timetable import. Read 09:41 Anna Nowak 09:42 Thanks, I will check again after lunch. Edited 09:44

Actions#

Buttons in the footer act on the answer: copy, regenerate, rate. A ghost bubble removes the indent of the header and footer.

How long does a refund take? Refunds for cancelled trains are paid within 7 working days, to the card used for the purchase. Tickets bought at a station can be refunded at any ticket office.

Files#

Attachment cards stand in the content column next to the bubbles.

ticket-4821.pdf PDF · 182 KB Here is the ticket I could not use. Thanks. Your refund form is filled in, please check it. refund-form.csv CSV · 4 KB

Consecutive messages#

In wds-message-group only the first message shows the name and only the last the avatar; empty wds-message-avatar elements keep the column.

Marek Wiśniewski I checked the delays from this morning. All of them go through the Tarnów junction. MW It is the signal fault, not the trains. EK That matches the maintenance log. I will send a crew.

Assistant answer#

A ghost bubble with a Code Block for an answer that spans the row.

How do I get the delay of a train in minutes? Subtract the planned time from the actual one and round to whole minutes: delay.ts
          const delay = Math.round((actual.getTime() - planned.getTime()) / 60_000);
        

API References#

wds-message#

One message in a conversation: wds-message-avatar and wds-message-content with a header, bubbles and a footer. align="end" puts the avatar on the other side and aligns the content to the end (the user's own messages). With a footer the avatar lines up with the last bubble, not with the footer.

Attributes

AttributeTypeDefaultDescription
alignWdsMessageAlign'start'end mirrors the message: avatar at the end, content aligned to the end.

Slots

SlotDescription
(default)wds-message-avatar and wds-message-content.

CSS custom properties

PropertyDescription
--wds-message-gapSpace between the avatar and the content (default 8px).

wds-message-avatar#

Place for the avatar of the sender, at the bottom of the message. Without content it keeps the space, so messages in a wds-message-group stay aligned.

Slots

SlotDescription
(default)A wds-avatar or an image.

wds-message-content#

The column with a header, bubbles, attachments and a footer. In a message with align="end" its children align to the end.

Slots

SlotDescription
(default)wds-message-header, wds-bubble, wds-attachment, wds-message-footer and other content.

wds-message-header#

Line above the bubbles: the sender name and the time.

Slots

SlotDescription
(default)Name, time and separators.

Line under the bubbles: delivery status, edits or actions such as copy and regenerate.

Slots

SlotDescription
(default)Text or buttons.

wds-message-group#

Consecutive messages from one sender, closer together than separate messages. Usually only the first message shows the name and only the last one the avatar; keep an empty wds-message-avatar in the others so the bubbles stay in one column.

Slots

SlotDescription
(default)wds-message elements.

CSS custom properties

PropertyDescription
--wds-message-group-gapSpace between the messages (default 8px).

Accessibility#

Screen reader#

Messages have no role and are read in document order. Put the sender name in wds-message-header (at least on the first message of a group): alignment and avatars alone do not tell screen reader users who wrote.

Decorative separators (dots) need aria-hidden="true". Footer buttons need a label; toggles such as a rating need aria-pressed.

In a scrolling thread use Message Scroller: it is a log region, so new messages are announced.

Keyboard support#

Messages are not focusable. Buttons, links and attachments inside them follow the page tab sequence.

Footer