Message
One chat message: who wrote it and when, the content, and small icon actions such as copy, retry and thumbs up or down. Same markup and props in every style: switch the style in the header to see it change.
Basic
An assistant message with copy, retry and thumbs up or down. In HTML, add data-vin-message to the article so copy and feedback work.
<article class="vin-message" data-vin-message style="max-width: 560px">
<div class="vin-message__avatar" aria-hidden="true">
<span class="vin-avatar vin-avatar--sm vin-avatar--square" role="img" aria-label="Assistant">
<span class="vin-avatar__fallback">AI</span>
</span>
</div>
<div class="vin-message__body">
<header class="vin-message__header">
<p class="vin-message__author">Assistant</p>
<time class="vin-message__time" datetime="2026-11-25T10:42">10:42</time>
</header>
<div class="vin-message__content">
<p>Here are three ways to speed up your build:</p>
<ul>
<li>Cache <code>node_modules</code> between runs.</li>
<li>Run the tests in parallel.</li>
<li>Only rebuild the packages that changed.</li>
</ul>
</div>
<div class="vin-message__actions" role="group" aria-label="Message actions">
<button type="button" class="vin-btn vin-btn--ghost vin-btn--icon" aria-label="Copy" data-vin-copy><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button>
<button type="button" class="vin-btn vin-btn--ghost vin-btn--icon" aria-label="Retry"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/></svg></button>
<button type="button" class="vin-btn vin-btn--ghost vin-btn--icon" aria-label="Good response" aria-pressed="false" data-vin-feedback="up"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/></svg></button>
<button type="button" class="vin-btn vin-btn--ghost vin-btn--icon" aria-label="Bad response" aria-pressed="false" data-vin-feedback="down"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 14V2"/><path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/></svg></button>
</div>
</div>
</article>import { Message, MessageAction, MessageCopy, MessageFeedback } from "@/components/vin/message";
import { Avatar } from "@/components/vin/avatar";
const RetryIcon = () => (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7L3 8" /><path d="M3 3v5h5" /></svg>
);
export function MessageBasic() {
return (
<Message
style={{ maxWidth: 560 }}
avatar={<Avatar name="Assistant" size="sm" shape="square" fallback="AI" />}
author="Assistant"
time="10:42"
dateTime="2026-11-25T10:42"
actions={
<>
<MessageCopy />
<MessageAction label="Retry"><RetryIcon /></MessageAction>
<MessageFeedback />
</>
}
>
<p>Here are three ways to speed up your build:</p>
<ul>
<li>Cache <code>node_modules</code> between runs.</li>
<li>Run the tests in parallel.</li>
<li>Only rebuild the packages that changed.</li>
</ul>
</Message>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Message, { MessageAction, MessageCopy, MessageFeedback } from "@/components/vin/message.vue";
import Avatar from "@/components/vin/avatar.vue";
</script>
<template>
<Message style="max-width: 560px" author="Assistant" time="10:42" date-time="2026-11-25T10:42">
<template #avatar><Avatar name="Assistant" size="sm" shape="square" fallback="AI" /></template>
<p>Here are three ways to speed up your build:</p>
<ul>
<li>Cache <code>node_modules</code> between runs.</li>
<li>Run the tests in parallel.</li>
<li>Only rebuild the packages that changed.</li>
</ul>
<template #actions>
<MessageCopy />
<MessageAction label="Retry">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7L3 8" /><path d="M3 3v5h5" /></svg>
</MessageAction>
<MessageFeedback />
</template>
</Message>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Message from "$lib/components/vin/message.svelte";
import MessageAction from "$lib/components/vin/message-action.svelte";
import MessageCopy from "$lib/components/vin/message-copy.svelte";
import MessageFeedback from "$lib/components/vin/message-feedback.svelte";
import Avatar from "$lib/components/vin/avatar.svelte";
</script>
{#snippet assistant()}<Avatar name="Assistant" size="sm" shape="square" fallback="AI" />{/snippet}
<Message style="max-width: 560px" avatar={assistant} author="Assistant" time="10:42" dateTime="2026-11-25T10:42">
<p>Here are three ways to speed up your build:</p>
<ul>
<li>Cache <code>node_modules</code> between runs.</li>
<li>Run the tests in parallel.</li>
<li>Only rebuild the packages that changed.</li>
</ul>
{#snippet actions()}
<MessageCopy />
<MessageAction label="Retry"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7L3 8" /><path d="M3 3v5h5" /></svg></MessageAction>
<MessageFeedback />
{/snippet}
</Message>Conversation
The person's message on the end side in a Bubble, and a reply they liked.
<div style="display: grid; gap: 20px; width: 100%; max-width: 560px">
<article class="vin-message vin-message--end">
<div class="vin-message__avatar" aria-hidden="true">
<span class="vin-avatar vin-avatar--sm" role="img" aria-label="Ada Lovelace">
<img class="vin-avatar__img" src="/ui/avatars/ada.svg" alt="">
<span class="vin-avatar__fallback">AL</span>
</span>
</div>
<div class="vin-message__body">
<header class="vin-message__header">
<p class="vin-message__author">You</p>
<time class="vin-message__time" datetime="2026-11-25T10:41">10:41</time>
</header>
<div class="vin-message__content">
<p class="vin-bubble vin-bubble--user">What does HTTP 429 mean?</p>
</div>
</div>
</article>
<article class="vin-message" data-vin-message>
<div class="vin-message__avatar" aria-hidden="true">
<span class="vin-avatar vin-avatar--sm vin-avatar--square" role="img" aria-label="Assistant">
<span class="vin-avatar__fallback">AI</span>
</span>
</div>
<div class="vin-message__body">
<header class="vin-message__header">
<p class="vin-message__author">Assistant</p>
<time class="vin-message__time" datetime="2026-11-25T10:41">10:41</time>
</header>
<div class="vin-message__content">
<p><strong>429 Too Many Requests</strong> means you sent more requests than the server allows. Wait for the time in the <code>Retry-After</code> header, then try again.</p>
</div>
<div class="vin-message__actions" role="group" aria-label="Message actions">
<button type="button" class="vin-btn vin-btn--ghost vin-btn--icon" aria-label="Copy" data-vin-copy><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button>
<button type="button" class="vin-btn vin-btn--ghost vin-btn--icon" aria-label="Good response" aria-pressed="true" data-vin-feedback="up"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/></svg></button>
<button type="button" class="vin-btn vin-btn--ghost vin-btn--icon" aria-label="Bad response" aria-pressed="false" data-vin-feedback="down"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 14V2"/><path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/></svg></button>
</div>
</div>
</article>
</div>import { Message, MessageCopy, MessageFeedback } from "@/components/vin/message";
import { Avatar } from "@/components/vin/avatar";
import { Bubble } from "@/components/vin/bubble";
export function MessageConversation() {
return (
<div style={{ display: "grid", gap: 20, width: "100%", maxWidth: 560 }}>
<Message
align="end"
avatar={<Avatar name="Ada Lovelace" size="sm" src="/ui/avatars/ada.svg" />}
author="You"
time="10:41"
dateTime="2026-11-25T10:41"
>
<Bubble as="p" from="user">What does HTTP 429 mean?</Bubble>
</Message>
<Message
avatar={<Avatar name="Assistant" size="sm" shape="square" fallback="AI" />}
author="Assistant"
time="10:41"
dateTime="2026-11-25T10:41"
actions={
<>
<MessageCopy />
<MessageFeedback defaultValue="up" />
</>
}
>
<p><strong>429 Too Many Requests</strong> means you sent more requests than the server allows. Wait for the time in the <code>Retry-After</code> header, then try again.</p>
</Message>
</div>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Message, { MessageCopy, MessageFeedback } from "@/components/vin/message.vue";
import Avatar from "@/components/vin/avatar.vue";
import Bubble from "@/components/vin/bubble.vue";
</script>
<template>
<div style="display: grid; gap: 20px; width: 100%; max-width: 560px">
<Message align="end" author="You" time="10:41" date-time="2026-11-25T10:41">
<template #avatar><Avatar name="Ada Lovelace" size="sm" src="/ui/avatars/ada.svg" /></template>
<Bubble as="p" from="user">What does HTTP 429 mean?</Bubble>
</Message>
<Message author="Assistant" time="10:41" date-time="2026-11-25T10:41">
<template #avatar><Avatar name="Assistant" size="sm" shape="square" fallback="AI" /></template>
<p><strong>429 Too Many Requests</strong> means you sent more requests than the server allows. Wait for the time in the <code>Retry-After</code> header, then try again.</p>
<template #actions>
<MessageCopy />
<MessageFeedback default-value="up" />
</template>
</Message>
</div>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Message from "$lib/components/vin/message.svelte";
import MessageCopy from "$lib/components/vin/message-copy.svelte";
import MessageFeedback from "$lib/components/vin/message-feedback.svelte";
import Avatar from "$lib/components/vin/avatar.svelte";
import Bubble from "$lib/components/vin/bubble.svelte";
</script>
{#snippet assistant()}<Avatar name="Assistant" size="sm" shape="square" fallback="AI" />{/snippet}
{#snippet ada()}<Avatar name="Ada Lovelace" size="sm" src="/ui/avatars/ada.svg" />{/snippet}
<div style="display: grid; gap: 20px; width: 100%; max-width: 560px">
<Message align="end" avatar={ada} author="You" time="10:41" dateTime="2026-11-25T10:41">
<Bubble as="p" from="user">What does HTTP 429 mean?</Bubble>
</Message>
<Message avatar={assistant} author="Assistant" time="10:41" dateTime="2026-11-25T10:41">
<p>
<strong>429 Too Many Requests</strong> means you sent more requests than the server allows. Wait for the time in the <code>Retry-After</code> header,
then try again.
</p>
{#snippet actions()}
<MessageCopy />
<MessageFeedback value="up" />
{/snippet}
</Message>
</div>Streaming
While the reply is written: a caret after the text and aria-busy. Add the actions when it's done.
<article class="vin-message vin-message--streaming" aria-busy="true" style="max-width: 560px">
<div class="vin-message__avatar" aria-hidden="true">
<span class="vin-avatar vin-avatar--sm vin-avatar--square" role="img" aria-label="Assistant">
<span class="vin-avatar__fallback">AI</span>
</span>
</div>
<div class="vin-message__body">
<header class="vin-message__header">
<p class="vin-message__author">Assistant</p>
<span class="vin-message__time">Writing…</span>
</header>
<div class="vin-message__content">
<p>Sure. Start by opening the settings page and choosing</p>
</div>
</div>
</article>import { Message } from "@/components/vin/message";
import { Avatar } from "@/components/vin/avatar";
export function MessageStreaming() {
return (
<Message
streaming
style={{ maxWidth: 560 }}
avatar={<Avatar name="Assistant" size="sm" shape="square" fallback="AI" />}
author="Assistant"
time="Writing…"
>
<p>Sure. Start by opening the settings page and choosing</p>
</Message>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Message from "@/components/vin/message.vue";
import Avatar from "@/components/vin/avatar.vue";
</script>
<template>
<Message streaming style="max-width: 560px" author="Assistant" time="Writing…">
<template #avatar><Avatar name="Assistant" size="sm" shape="square" fallback="AI" /></template>
<p>Sure. Start by opening the settings page and choosing</p>
</Message>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Message from "$lib/components/vin/message.svelte";
import Avatar from "$lib/components/vin/avatar.svelte";
</script>
{#snippet assistant()}<Avatar name="Assistant" size="sm" shape="square" fallback="AI" />{/snippet}
<Message streaming style="max-width: 560px" avatar={assistant} author="Assistant" time="Writing…">
<p>Sure. Start by opening the settings page and choosing</p>
</Message>Installation
React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:
npx @vinish/ui add messageimport { Message, MessageAction, MessageCopy, MessageFeedback } from "@/components/vin/message";import Message, { MessageAction, MessageCopy, MessageFeedback } from "@/components/vin/message.vue";import Message from "$lib/components/vin/message.svelte";
import MessageAction from "$lib/components/vin/message-action.svelte";
import MessageCopy from "$lib/components/vin/message-copy.svelte";
import MessageFeedback from "$lib/components/vin/message-feedback.svelte";The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.
Plain HTML: the classes come with the style's stylesheet. This component also needs vinui.js for its keyboard and pointer behaviour.
API
From spec/message.json, which every framework version is tested against.
| Prop | Values | Default | In HTML |
|---|---|---|---|
authorWho wrote it. | ReactNode | — | .vin-message__author |
avatarUsually an Avatar. Hidden from screen readers, because the author name says who it is. | ReactNode | — | .vin-message__avatar[aria-hidden=true] > .vin-avatar |
time / dateTimeThe time to show, and the machine-readable time (then it is a <time> element). | ReactNode / string | — | time.vin-message__time[datetime] |
align"end" puts the avatar on the end side, for the person's own messages. | startend | start | vin-message--end |
streamingThe reply is still being written: a caret after the text, and aria-busy so screen readers wait. | boolean | false | vin-message--streaming |
actionsIcon buttons under the content. | ReactNode | — | .vin-message__actions[role=group][aria-label] |
MessageActionA small icon button with a label (its aria-label). pressed makes it a toggle. | component | — | button.vin-btn.vin-btn--ghost.vin-btn--icon[aria-label] |
MessageCopyCopies the content (or text) and says "Copied" for two seconds. | component | — | the button with data-vin-copy (vinui.js; add data-vin-message to the article) |
MessageFeedbackThumbs up and down; one at a time. value, defaultValue, onValueChange ("up" | "down" | null). | component | — | buttons with data-vin-feedback="up|down" and aria-pressed (vinui.js); listen for the vin-feedback event |
Parts
| React, Vue, Svelte | HTML classes |
|---|---|
<Message><MessageAction><MessageCopy><MessageFeedback> | .vin-message.vin-message--end.vin-message--streaming.vin-message__avatar.vin-message__body.vin-message__header.vin-message__author.vin-message__time.vin-message__content.vin-message__actions |
Accessibility
- Each message is an <article>; the author and a <time> element come first, so screen readers say who and when before the content.
- The avatar is hidden from screen readers because the author name already says who it is.
- Actions are a labelled group of buttons. Every icon button has a label, and the thumbs use aria-pressed so their state is read out.
- Actions are always visible, not only on hover, so they work with touch and the keyboard.
- While a reply streams, aria-busy="true" asks screen readers to wait until it is finished. The caret stops blinking when motion is reduced.
Customize
Saved in this browser. Style and accent are in the header.