Message actions
v0.64.0, changelogBetaThe actions under a model's answer (Copy, Regenerate, Good and Bad with a reason, a ‹ 2 / 3 › switcher), quiet until hovered or focused, always shown on touch and to the keyboard.
Under an answer
Install
npx shadcn add @syncrobotic/message-actions Also installs: lucide-react@^1, @syncrobotic/cn, @syncrobotic/button, @syncrobotic/chip-group, @syncrobotic/copy-button, @syncrobotic/format-number
Overview
When to use
- Every assistant answer in a conversation.
- An answer whose quality feeds an evaluation: Good and Bad with reasons.
- An answer people regenerate until it suits them: the ‹ 2 / 3 › switcher.
Use something else
- One value to copy beside a label: Copy button.
- Actions on a record in a list: Dropdown menu (DropdownMenuMoreTrigger).
- A form people fill in about an answer: Questionnaire.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Bad with reason
Versions
Copy only
Traditional Chinese (zh-TW)
Usage rules
- It goes in Message's
actions. Each part shows only when you give what it needs:copyTextfor Copy,onRegeneratefor Regenerate,onFeedbackChangefor Good and Bad,versionsabove 1 for the switcher. - Good and Bad are toggles (aria-pressed), inverted when pressed like every selected control, never green or red. Pressing the pressed one again clears it.
- Give
reasonsto ask what was wrong after Bad: a few short ones ("Wrong facts", "Did not follow the request"). Send the feedback and the reason fromonFeedbackChangeandonReasonChange. - Regenerating adds a version: pass
versionandversionsand switch the shown answer inonVersionChange. The switcher's ends stay focusable and say they are the end. quiet(on by default) keeps the buttons out of sight until the turn is hovered or focused, with a mouse only: touch screens and keyboards always see them. Set it false on the latest answer. Feedback that was given and the switcher never hide.- Every button is an icon with its name in
aria-label; 36 px with a mouse, 44 on touch.
Changelog
- 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
- 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.
- 0.51.02026-11-27Comments trimmed to what they need to say; the code is unchanged.