Skip to content

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.

Assistant

Here are three ways to speed up your build:

  • Cache node_modules between runs.
  • Run the tests in parallel.
  • Only rebuild the packages that changed.
message-basic.html
<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>

Conversation

The person's message on the end side in a Bubble, and a reply they liked.

You

What does HTTP 429 mean?

Assistant

429 Too Many Requests means you sent more requests than the server allows. Wait for the time in the Retry-After header, then try again.

message-conversation.html
<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>

Streaming

While the reply is written: a caret after the text and aria-busy. Add the actions when it's done.

Assistant

Writing…

Sure. Start by opening the settings page and choosing

message-streaming.html
<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>

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:

Terminal
npx @vinish/ui add message
React
import { Message, MessageAction, MessageCopy, MessageFeedback } from "@/components/vin/message";
Vue
import Message, { MessageAction, MessageCopy, MessageFeedback } from "@/components/vin/message.vue";
Svelte
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.

PropValuesDefaultIn HTML
author
Who wrote it.
ReactNode—.vin-message__author
avatar
Usually an Avatar. Hidden from screen readers, because the author name says who it is.
ReactNode—.vin-message__avatar[aria-hidden=true] > .vin-avatar
time / dateTime
The 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.
startendstartvin-message--end
streaming
The reply is still being written: a caret after the text, and aria-busy so screen readers wait.
booleanfalsevin-message--streaming
actions
Icon buttons under the content.
ReactNode—.vin-message__actions[role=group][aria-label]
MessageAction
A 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]
MessageCopy
Copies 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)
MessageFeedback
Thumbs 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, SvelteHTML 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.