Message actions
Free · MITCopy, retry and rate under an agent's reply. Each action appears only when its handler is given. Copy reports what the clipboard did: the icon stays a copy icon until the write settles, then becomes a tick (or a cross when the clipboard refused). A rating is the caller's state, so it shows only what the service recorded.
Preview
Install
With the Candor CLI
First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/message-actions
Brings in: locale, tooltip, use-copy, utils · npm: lucide-react@^1.67.0
Usage
"use client"
import * as React from "react"
import { MessageActions, type Rating } from "@/components/message-actions"
export default function Example() {
const [rating, setRating] = React.useState<Rating>(null)
return <MessageActions text="It shipped this morning." rating={rating} onRate={setRating} onRetry={() => {}} meta="claude-sonnet-5-5 · $0.003" />
}<MessageActions>
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | undefined | — | What Copy copies; without it there's no Copy. |
| onRetry | (() => void) | undefined | — | Shows Retry. |
| rating | Rating | undefined | — | The current rating: up, down or none. |
| onRate | ((rating: Rating) => void) | undefined | — | Shows thumbs up and down. |
| meta | React.ReactNode | undefined | — | Facts after the actions, e.g. the model and cost. |
| className | string | undefined | — | Extra classes for the outer element. |
Strings
The fixed words, in English by default. Change any of them under messageActions in <LocaleProvider strings={{ … }}>; the table is exported as messageActionsStrings.
| Key | English |
|---|---|
| copy | Copy |
| copied | Copied |
| copyFailed | Couldn’t copy |
| retry | Retry |
| good | Good answer |
| bad | Bad answer |
Types
- Rating
"up" | "down" | null