Message feedback
Thumbs up and down. The icon fills when chosen, thumbs down asks what went wrong, and both end with a quiet thank-you.
On this page
Thumbs down asks why with inline chips.
Installation
Usage
import { MessageFeedback } from "@/components/ui/chatcn/message-feedback"
<MessageActions>
<MessageFeedback
onValueChange={(value) => rate(message.id, value)}
onReason={(reasons, note) => report(message.id, reasons, note)}
/>
</MessageActions>Examples
Popover
Pick several reasons and add a note. Enter sends the note.
Pick reasons and add a note.
Props
| Prop | Type | Notes |
|---|---|---|
value, defaultValue | "up" | "down" | null | Controlled or uncontrolled |
onValueChange | (value) => void | Clicking the active thumb again clears it |
reasons | string[] | Offered after thumbs down. An empty array skips the question |
reasonMode | "chips" | "popover" | Inline chips under the toolbar, or a popover with a note |
onReason | (reasons, note?) => void | The picked reasons |
thanks | string | Defaults to Thanks for the feedback |
Accessibility
- The thumbs are toggle buttons with
aria-pressed, named Good response and Bad response. - The thank-you is a polite live region.
- In the popover, focus moves to the first reason and returns to the thumb when it closes.
Motion
- Choosing a thumb swaps outline for filled with a 150 ms blur crossfade. From the keyboard, the swap is instant.
- The reason chips drop in 4 px over 180 ms. The thank-you fades in, stays 2.4 s and fades out.