Create

General

Bubble

Copy page View as Markdown Open in ChatGPT Open in Claude

A chat bubble with the text of one message, in seven variants, with reactions and quick replies.

Usage#

app.component.ts
import { WDS_BUBBLE } from '@wds/angular/bubble';

For a full message with an avatar, a name and a status, put bubbles in Message.

Examples#

Default#

align="end" moves the user's own bubbles to the end of the row. A bubble is at most 80% wide.

Hi! My train to Gdaล„sk was cancelled. Can I use the ticket on the next one? Yes, the ticket is valid on any train on that route today. Great, thanks.

Variants#

default, secondary, muted, tinted, outline, destructive and ghost (no bubble, the full width of the row).

Default: the user's own message. Secondary: a status update. Muted: a message from someone else. Tinted: a shade of the primary color. Outline: on a busy background. Destructive: the message could not be sent. Ghost: no bubble at all, the full width of the row, for long answers.

Group#

wds-bubble-group keeps consecutive bubbles from one sender closer together.

The 7:40 from Krakรณw is running late. About 15 minutes, a signal fault near Tarnรณw. Thanks for the heads-up. Will I still make the connection in Katowice?

Reactions#

wds-bubble-reactions hangs a pill off the bottom or top edge (side) at the start or end (align). Static emoji get role="img" and an aria-label; with a button the pill is the button. Leave more space between bubbles with reactions.

Platform changes now show up in the app. ๐Ÿ‘ ๐ŸŽ‰ Rolling it out to all stations tomorrow. ๐ŸŽ‰ 3 The timetable PDF is updated too. ๐Ÿ‘€

Quick replies#

interactive makes the content a button and href a link, both with a hover color and a focus ring.

Which ticket do you need help with?
Single ticket Monthly pass Refund policy

API References#

wds-bubble#

A chat bubble: wds-bubble-content with the text and optionally wds-bubble-reactions. The variant colors the content; align="end" moves the bubble to the end of the row (the sender's own messages). Up to 80% wide, ghost takes the full width (e.g. an assistant answer).

Attributes

AttributeTypeDefaultDescription
variantWdsBubbleVariant'default'Color of the content.
alignWdsBubbleAlign'start'end moves the bubble to the end of the row. Inside wds-message the message alignment is used.

Slots

SlotDescription
(default)wds-bubble-content elements and wds-bubble-reactions.

CSS custom properties

PropertyDescription
--wds-bubble-max-widthLargest width of the bubble (default 80%, ghost: 100%).

wds-bubble-content#

The visible bubble with the text, colored by the variant of wds-bubble. With href it is a link and with interactive a button (e.g. a quick reply); both get a hover color and a focus ring.

Attributes

AttributeTypeDefaultDescription
hrefstring | undefinedMakes the bubble a link.
targetstring | undefinedLink target, e.g. _blank.
interactivebooleanfalseMakes the bubble a button; listen to click on the element.

Slots

SlotDescription
(default)Text and other content.

CSS parts (::part)

PartDescription
contentThe bubble (div, a or button).

wds-bubble-reactions#

A pill with reactions hanging off the edge of wds-bubble. Static emoji need a name for screen readers (role="img" and aria-label on the element); with a button inside the pill drops its padding and the button is the hit area. Leave extra space between bubbles with reactions, the pill sticks out three quarters of its height.

Attributes

AttributeTypeDefaultDescription
sideWdsBubbleReactionsSide'bottom'Edge of the bubble the pill hangs from.
alignWdsBubbleReactionsAlign'end'Corner of the bubble.

Slots

SlotDescription
(default)Emoji, counts or a wds-button.

wds-bubble-group#

Consecutive bubbles from one sender, closer together than separate messages.

Slots

SlotDescription
(default)wds-bubble elements.

CSS custom properties

PropertyDescription
--wds-bubble-group-gapSpace between the bubbles (default 8px).

Accessibility#

Screen reader#

Bubbles have no role: the text is read in document order. Say who sent a message in the text around it (a name in wds-message-header), because alignment and color are not announced.

wds-bubble-content with interactive is a native <button>, with href a native <a>.

Reactions made of emoji need role="img" and an aria-label that lists them; a reaction button needs a label with the count and aria-pressed.

Keyboard support#

KeyFunction
TabMoves focus to interactive bubbles, links and reaction buttons.
EnterActivates the focused bubble or link.
SpaceActivates the focused interactive bubble.
Footer