Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Display

Chat <pm-chat>

Chat message list for support chat, team messaging and AI assistants.

Full screen
Today Hi! Is the March invoice ready? Almost. I am adding the last two line items now. invoice-march.pdf

This component has no props to try here.

<script type="module"> import '@prismora/css'; import '@prismora/elements/avatar'; import '@prismora/elements/button'; import '@prismora/elements/chat'; import '@prismora/elements/tag'; import { registerIcons } from '@prismora/elements/icon'; import { paperclip, reply, thumbsUp } from '@prismora/icons'; registerIcons([paperclip, reply, thumbsUp]); </script> <div class="pm-stack" style="inline-size: min(100%, 28rem)"> <pm-chat label="Conversation with Ada" style="block-size: 20rem"> <span class="pm-chat-day">Today</span> <pm-chat-message name="Ada" time="09:41"> <pm-avatar slot="avatar" name="Ada Lovelace" size="sm"></pm-avatar> Hi! Is the March invoice ready? <pm-button slot="actions" size="xs" variant="ghost" tone="neutral" icon icon-start="thumbs-up" label="Like"></pm-button> <pm-button slot="actions" size="xs" variant="ghost" tone="neutral" icon icon-start="reply" label="Reply"></pm-button> </pm-chat-message> <pm-chat-message from="me" time="09:42" status="Read">Almost. I am adding the last two line items now.</pm-chat-message> <pm-chat-message name="Ada" typing> <pm-avatar slot="avatar" name="Ada Lovelace" size="sm"></pm-avatar> </pm-chat-message> </pm-chat> <pm-composer label="Message Ada" placeholder="Write a message"> <pm-tag slot="top" icon-start="paperclip" removable>invoice-march.pdf</pm-tag> <pm-button slot="start" size="sm" variant="ghost" tone="neutral" icon icon-start="paperclip" label="Attach a file"></pm-button> </pm-composer> </div>

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

AttributeTypeDefaultDescription
labelstring—Accessible name of the conversation.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Slots

SlotDescription
(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

AttributeTypeDefaultDescription
from'me' | 'them'—me (own message, end side) or them (default).
namestring—Sender name shown above the bubble.
timestring—Time text, e.g. "09:41".
statusstring—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).
streamingboolean—Text is still arriving: shows a caret and marks the message busy.
typingboolean—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

SlotDescription
(default)Message content.
avatarA <pm-avatar> for the sender.
actionsButtons 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

AttributeTypeDefaultDescription
valuestring—Current value.
labelstring—Accessible name of the text box.
placeholderstring—Hint text shown while empty (not a replacement for label).
disabledboolean—Not interactive (and not submitted, for form controls).
busyboolean—A reply is being produced: Send becomes Stop.
maxlengthnumber—Maximum number of characters.
send-label
prop: 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

EventReact / Svelte propDescription
pm-sendonPmSendA message was submitted. The box clears unless the event is cancelled.
pm-stoponPmStopStop was pressed while busy.
pm-inputonPmInputThe text changed.

Slots

SlotDescription
startButtons before the text (attach, emoji).
topContent above the text (attachments, a reply preview, suggestion chips).

Used in templates

Team chatAI assistant