Skip to content

Message Actions

The quiet action bar under an assistant message: Copy, thumbs up and down with a short reason picker, Regenerate with a version switcher, and an overflow menu with Read aloud and your own actions.

On this page
Used for
  • Copy a reply
  • Regenerate a reply
  • Rate a response
  • Switch reply versions
  • Read a reply aloud

Examples

Installation

npx knowns-ui@latest add message-actions
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

text
string
The message, for Copy and Read aloud.
onCopy
() => void
After the text is copied. The icon turns into a check for a moment.
onRegenerate / regenerating
() => void | Promise / boolean
Shows Regenerate. The icon spins while the promise is pending, or while regenerating is true.
version / versions / onVersionChange
number / number / (v) => void
Default1 / 1
From two versions on, a ‹ 2/3 › switcher appears next to Regenerate.
feedback / onFeedback
Feedback / (value, reason?) => void
Thumbs up or down (click again to clear). Down opens a small picker; Send passes { reasons, note }.
reasons
string[]
Default5 defaults
Chips in the picker.
readAloud / onReadAloud
boolean / (playing) => void
Defaulttrue
Read aloud in the overflow menu, with the browser's speech where there is one. While reading, a Stop button with a small equalizer shows.
more / onMore
MenuItem[] / (item) => void
Your own actions in the overflow menu.

Accessibility

  • A toolbar with one tab stop: Left and Right Arrow move between buttons, Home and End jump to the ends.
  • Every button has a name and a tooltip; thumbs are toggle buttons (aria-pressed).
  • Copied, thanks and reading states are announced in a polite live region.
  • With reduced motion the pop, spin and equalizer are still.

What it handles

  1. 01Copies the text prop to the clipboard, turns the icon into a check for about a second and a half, and calls onCopy.
  2. 02Shows Regenerate when you pass onRegenerate, spins until a returned promise settles, or follows the regenerating prop.
  3. 03Adds a version switcher such as 2/3 once versions is above one, and calls onVersionChange as you step through.
  4. 04Toggles thumbs up and down with aria-pressed, and a thumbs down opens a reason picker of chips and a short note before it sends.
  5. 05Puts Read aloud in the overflow menu using browser speech, with a live equalizer while it plays, and appends your own items from more.
  6. 06Acts as one toolbar: one tab stop, with arrow keys moving between buttons, and a polite live region announces each result.

States

First render
Nothing. The bar paints as it is
none
Copy
The icon swaps to a check, then back
none
Thumb pressed
The icon pops up and settles
280ms, ease out
Reason picker opens
It slides in from slightly above
180ms, ease out
Regenerating
The icon spins until it settles
none
Reading aloud
Three equalizer bars move
none
Reduced motion
Pop, spin and equalizer stay still
0ms

Works with

When to use

When to use

  • Copy, rate, regenerate and read aloud under each assistant message.
  • Collecting why an answer was bad, in two clicks, without leaving the chat.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Message Actions to my app and wire it to my own data.
  • I need copy, rate, regenerate and read aloud under each assistant message. Set that up with the Knowns UI Message Actions.
  • Which Message Actions props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "message-actions" }) and search_docs({ query: "message actions" }).

Need help?

Stuck on Message Actions, or found something off? We read every message.