Message actions

Free · MIT

Copy, 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.

Markdown

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

TSX · The example above
"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>

PropTypeDefaultDescription
textstring | undefined—What Copy copies; without it there's no Copy.
onRetry(() => void) | undefined—Shows Retry.
ratingRating | undefined—The current rating: up, down or none.
onRate((rating: Rating) => void) | undefined—Shows thumbs up and down.
metaReact.ReactNode | undefined—Facts after the actions, e.g. the model and cost.
classNamestring | 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.

KeyEnglish
copyCopy
copiedCopied
copyFailedCouldn’t copy
retryRetry
goodGood answer
badBad answer

Types

Rating
"up" | "down" | null