Ballmac UI home

Message Actions

New

The small bar under an AI reply: copy, try again, good or bad answer (with reasons), branch, share. A real toolbar with arrow-key movement, spoken results, and choices taken back with the reason when they cannot be saved.

v1.0.0Updated Oct 25, 2026Ships with a test
What changed

Your refund of $340 was issued on 14 October and returned by the bank because the card had expired. I have re-issued it as store credit, which is in your account now.

Installation

$ pnpm dlx shadcn@latest add @ballmac/message-actions

Usage

import { MessageActions } from "@/components/ballmac/message-actions"

The full example is in the Code tab above.

Examples

Copy only

API reference

PropTypeDefault
text

The message text, copied by Copy. Leave it out to hide Copy.

string—
onRegenerate

Adds Regenerate. Reject and the bar says why.

() => void | Promise<void>—
onFeedback

Adds the thumbs. Called with the choice, and for a thumbs down the reason picked. Reject and the choice is taken back.

(value: Feedback, reason?: string) => void | Promise<void>—
onBranch

Adds Branch, which continues the conversation from here.

() => void | Promise<void>—
onShare

Adds Share.

() => void | Promise<void>—
reasons

The reasons offered after a thumbs down.

string[]DEFAULT_REASONS
defaultFeedback

The feedback already given, if any.

Feedback | nullnull

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Toolbarrole=toolbar with a label; one button is in the tab order and Left, Right, Home and End move between buttons, wrapping at the ends
ButtonsIcon buttons with a name and a title; the thumbs have pressed state
ResultsCopied, the thanks and any error are in one live region; errors are alerts
ReasonsA labelled group of buttons after a thumbs down, with Skip

Use with AI

Each button appears only when you give it something to do: text (Copy), onRegenerate, onFeedback(value, reason?) (the thumbs; a thumbs down asks for a reason from reasons, default five, or Skip), onBranch, onShare. defaultFeedback. Handlers may be async; a rejection is shown as an alert and a thumbs choice is taken back. With nothing to do it renders nothing. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Message Actions (@ballmac/message-actions) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Under every assistant message in a chat or a run
  • Collecting quick feedback with a reason on a bad answer

Not for

  • Actions on a person's own message; use a menu
  • A formal rating form; use a form

Registry JSON: https://ui.ballmac.com/r/message-actions.json

Credits

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.