Chat <pm-chat>
Chat message list for support chat, team messaging and AI assistants.
Overview
New messages are announced to screen readers, and the list stays pinned to the latest message while the reader is at the bottom; after scrolling up, a "Jump to latest" button appears instead of moving the page. Give it a height (or put it in a flex/grid cell) so it scrolls.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
label | string | — | Accessible name of the conversation. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Slots
| Slot | Description |
|---|---|
(default) | <pm-chat-message> elements (and .pm-chat-day date separators). |
Methods
scrollToLatest()
<pm-chat-message>
One chat message: a bubble with optional sender name, time, avatar and delivery status.
from="me" puts it on the end side in the tone colour. For AI answers use variant="plain"; streaming shows a caret while text arrives and typing shows the three-dot indicator.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
from | 'me' | 'them' | — | me (own message, end side) or them (default). |
name | string | — | Sender name shown above the bubble. |
time | string | — | Time text, e.g. "09:41". |
status | string | — | Delivery status under the bubble: "Sent", "Read", "Failed"… ("Failed" is shown in the danger colour). |
variant | 'bubble' | 'plain' | — | bubble (default) or plain (no bubble, full width). |
streaming | boolean | — | Text is still arriving: shows a caret and marks the message busy. |
typing | boolean | — | Show the typing indicator instead of content. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Slots
| Slot | Description |
|---|---|
(default) | Message content. |
avatar | A <pm-avatar> for the sender. |
actions | Buttons under the message (copy, retry, feedback). |
<pm-composer>
Message composer: a text box that grows with its content and a send button.
Enter sends, Shift+Enter adds a line (on phones Enter adds a line and the button sends). While busy, the button becomes Stop and fires pm-stop.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
value | string | — | Current value. |
label | string | — | Accessible name of the text box. |
placeholder | string | — | Hint text shown while empty (not a replacement for label). |
disabled | boolean | — | Not interactive (and not submitted, for form controls). |
busy | boolean | — | A reply is being produced: Send becomes Stop. |
maxlength | number | — | Maximum number of characters. |
send-labelprop: sendLabel | string | — | Text of the send button's accessible name (default "Send"). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-send | onPmSend | A message was submitted. The box clears unless the event is cancelled. |
pm-stop | onPmStop | Stop was pressed while busy. |
pm-input | onPmInput | The text changed. |
Slots
| Slot | Description |
|---|---|
start | Buttons before the text (attach, emoji). |
top | Content above the text (attachments, a reply preview, suggestion chips). |