Prodular UI

Message actions

AI

The row of quiet icon buttons under a message: copy, regenerate, rate with a reason, share and switch between versions.

npx prodular-ui add message-actions

On a message

Shown on hover and focus, always on touch. Use visibility="always" for the latest answer.

What is our net revenue retention for Q3?
Ledgerline Copilot

NRR is 112% for Q3. Expansion added $186,000 (mostly Halcyon Health and Orbis Retail) against $74,000 of churn and contraction, up from 108% in Q2.

Hover the question to see its copy action. The latest answer keeps its actions visible.

Feedback

Thumbs down opens a short form with reason chips and an optional comment.

Press thumbs down to open the feedback form

Anatomy

<MessageActions>  <MessageActionCopy value={markdown} />  <MessageAction label="Regenerate" onClick={regenerate}><RefreshCwIcon /></MessageAction>  <MessageActionFeedback onValueChange={rate} onFeedback={sendFeedback} />  <MessageVersions value={2} total={3} onValueChange={setVersion} /></MessageActions>

Guidance

Use it when

  • Under every assistant message: copy, regenerate and feedback at least. Under user messages: copy and edit.
  • MessageVersions when a message was regenerated or edited and older versions are kept.

Avoid

  • Text buttons or filled buttons here. The actions should stay out of the way of the answer.
  • More than six actions. Put the rest in a menu.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Place MessageActions inside MessageContent, after Response and Sources, so hover follows the message.
  • Set visibility="always" on the latest assistant message and leave the default on older ones.
  • Give every MessageAction a verb first label. It is the tooltip and the accessible name.
  • Pass the raw markdown of the answer to MessageActionCopy value, not the rendered text.
  • Send ratings to your backend in onValueChange and the reasons in onFeedback. Keep reasons to five or fewer and specific to the product.
  • Render MessageVersions only when total is 2 or more, and keep value one based.

API

MessageActions

PropTypeDefaultDescription
visibility"hover" | "always""hover"Hover reveals on pointer devices and stays visible on touch.

MessageAction

PropTypeDefaultDescription
labelstringTooltip and aria-label.

MessageActionCopy

PropTypeDefaultDescription
valuestringCopied to the clipboard. Shows a check for two seconds.

MessageActionFeedback

PropTypeDefaultDescription
value / onValueChange"up" | "down" | nullCurrent rating.
onFeedback({ reasons, comment }) => voidCalled when the thumbs down form is sent.
reasonsstring[]Reason chips in the form.

MessageVersions

PropTypeDefaultDescription
value / total / onValueChangenumberOne based version switcher, 2 of 3.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add message-actions# or, with the registry in components.jsonnpx shadcn@latest add @prodular/message-actions

Used in these screens