Message
Message lays out one conversation turn, with an avatar, a header, a body and a footer. Use it for chat and assistant threads, with Bubble or Attachment as the body. Message holds no chat state, so your app owns the messages and MessageScroller handles scrolling.
This example also needs: Bubble.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
Alignment
Set align="end" on your own turns to place them on the opposite side.
Without avatar
Leave out MessageAvatar for a compact thread with no avatar column.
Typing indicator
Show typing in an always-mounted role="status" region next to the log, with the state also written in the footer.
This example also needs: Button.
Grouped turns
Show the avatar once per run of turns, with placeholder avatars keeping later turns aligned.
With actions
Put copy and retry icon buttons, each with an aria-label and a tooltip, in a turn's footer.
With attachment
Use an Attachment as the body of a turn to share a file.
This example also needs: Attachment.
Props
Message
| Prop | Type | Default | Description |
|---|---|---|---|
align | "end" | "start" | "start" | Side of the conversation the turn sits on, mirrored under |
MessageAvatar
| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | boolean | false | Keeps the avatar's space but hides it. Use it on follow-up turns from the same speaker so their bodies line up with the first turn. |
ring | boolean | false | Draws a non-interactive emphasis ring, such as for a selected person. Put focus rings on the interactive wrapper. |
shape | "rounded" | "circle" | null | "circle" | No description |
size | "sm" | "lg" | "2xs" | "xs" | "md" | "xl" | "2xl" | "3xl" | "4xl" | null | "sm" | No description |
MessageContent
MessageContent adds no props of its own; it accepts the props of the element or primitive it wraps.
MessageFooter
MessageFooter adds no props of its own; it accepts the props of the element or primitive it wraps.
MessageGroup
| Prop | Type | Default | Description |
|---|---|---|---|
announce | boolean | false | Announces new turns in a live chat. Leave it off for static, paged or virtualised transcripts, and set |
MessageHeader
MessageHeader adds no props of its own; it accepts the props of the element or primitive it wraps.
Message lays out one conversation turn, with an avatar, a header, a body and a footer. Use it for chat and assistant threads, with Bubble or Attachment as the body. Message holds no chat state, so your app owns the messages and MessageScroller handles scrolling.
This example also needs: Avatar, Bubble.
Installation
Install these components first:
Copy and paste the following code into your project.
components/message/Message.vue components/message/MessageAvatar.vue components/message/MessageContent.vue components/message/MessageFooter.vue components/message/MessageGroup.vue components/message/MessageHeader.vue components/message/index.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
Alignment
Set align="end" on your own turns to place them on the opposite side.
Without avatar
Leave out MessageAvatar for a compact thread with no avatar column.
Typing indicator
Show typing in an always-mounted role="status" region next to the log, with the state also written in the footer.
This example also needs: Button.
Grouped turns
Show the avatar once per run of turns, with placeholder avatars keeping later turns aligned.
With actions
Put copy and retry icon buttons, each with an aria-label and a tooltip, in a turn's footer.
This example also needs: Button, Tooltip.
With attachment
Use an Attachment as the body of a turn to share a file.
This example also needs: Attachment.
Props
Message
| Prop | Type | Default | Description |
|---|---|---|---|
align | "start" | "end" | "start" | Side of the conversation the turn sits on, mirrored under |
MessageAvatar
| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | boolean | false | Keeps the avatar's space but hides it. Use it on follow-up turns from the same speaker so their bodies line up with the first turn. |
ring | boolean | false | Draws a non-interactive emphasis ring, such as for a selected person. Put focus rings on the interactive wrapper. |
shape | "circle" | "rounded" | null | "circle" | No description |
size | "sm" | "lg" | "2xs" | "xs" | "md" | "xl" | "2xl" | "3xl" | "4xl" | null | "sm" | No description |
MessageContent
MessageContent adds no props of its own; it accepts the props of the element or primitive it wraps.
MessageFooter
MessageFooter adds no props of its own; it accepts the props of the element or primitive it wraps.
MessageGroup
| Prop | Type | Default | Description |
|---|---|---|---|
announce | boolean | false | Announces new turns in a live chat. Leave it off for static, paged or virtualised transcripts, and set |
MessageHeader
MessageHeader adds no props of its own; it accepts the props of the element or primitive it wraps.