Skip to content
GitHub (opens in a new tab)

MessageActions

The compact action row on a chat message: copy, retry or edit, thumbs up / down with reasons, and a More menu. Icon Buttons with Tooltips.

stableMoleculecontracts/messageactions.json

Preview

MessageActions

The action row on a chat message. Not ButtonGroup. Not DropdownMenu alone.

Master

Copy swaps to Copied for 2s; thumbs toggle; a thumbs down offers reasons.

Assistant

Totals now round half-even in integer cents. All 38 tests pass.

Usage

MessageActions sits under a message. Every icon has a name and a Tooltip. With visible="hover" it shows on hover or keyboard focus of the message (data-message-actions-host).

Do's

  • actions under an assistant or user message
  • collect quick feedback on a reply
  • show actions only on hover or focus in a dense thread

Don'ts

  • page or table toolbars — ButtonGroup
  • a menu on its own — DropdownMenu
<MessageActions
  onCopy={copy}
  copied={copied}
  onRetry={retry}
  onFeedback={setFeedback}
  feedback={feedback}
  reasons={["Wrong", "Too long", "Not what I asked"]}
  moreItems={moreItems}
  onAction={act}
/>

When to use

  • actions under an assistant or user message
  • collect quick feedback on a reply
  • show actions only on hover or focus in a dense thread

When not to use

  • page or table toolbars — ButtonGroup
  • a menu on its own — DropdownMenu

What an agent reads

import { MessageActions } from "agentic-ds-kit";
must
  • the buttons sit in role=toolbar named by label
  • every icon Button has an accessible name and a Tooltip
  • thumbs are toggle buttons with aria-pressed
  • reasons are toggle Buttons with aria-pressed in a group named "What went wrong?"
  • thanks text is role=status
  • hover-only rows still show on keyboard focus and always show under prefers-reduced-motion
  • More is the kit DropdownMenu
  • built-in labels (copy, retry, edit, goodResponse, badResponse, moreActions, whatWentWrong) come from KitLabelsProvider; English by default
defaults
  • label Message actions
  • copied false
  • retrying false
  • feedback null
  • thanksText Thanks, noted
  • visible always
  • disabled false
stops if
  • Do not invent a local MessageToolbar or ChatActions
  • Do not use icon-only buttons without names
  • Do not put a solid primary Button in the row
  • Do not use raw hex

From contracts/messageactions.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
labelstringNoMessage actions—
onCopyfunctionNo——
copiedbooleanNofalseShows Copied in place of copy.
onRetryfunctionNo——
retryingbooleanNofalse—
onEditfunctionNo—User messages.
onFeedbackfunctionNo—("up" | "down" | null) => void. Shows thumbs.
feedbackup | down | nullNonull—
thanksTextstringNoThanks, notedAfter a thumbs up, or after a reason is picked: "Thanks, noted: <reason>".
reasonsstring[]No—Toggle Buttons (sm) after a thumbs down, in a group named "What went wrong?".
onReasonfunctionNo—(reason) => void
selectedReasonstringNo—The picked reason (controlled). Its Button is pressed.
moreItemsarrayNo—kit DropdownMenu items.
onActionfunctionNo—(id) => void
visiblealways | hoverNoalwayshover: shown on hover or focus of the row or of an ancestor with data-message-actions-host.
disabledbooleanNofalseMessage still streaming.
  • Component
    →

    ButtonGroup

    Joined row of kit Buttons that share one size and act as one control cluster.

  • Component
    →

    DropdownMenu

    Actions or value menu from a button, field, or nav trigger.