Major Chords
FeedbackButtons
Thumbs up / thumbs down feedback buttons with automatic state management.
Overview
FeedbackButtons provides thumbs up and thumbs down buttons for assistant messages. It wraps ActionBarPrimitive.FeedbackPositive and ActionBarPrimitive.FeedbackNegative, which handle submitFeedback calls and highlight the selected button automatically via data-submitted.
Demo
When to use
- Collect user feedback on assistant responses
- Show which response was rated positively or negatively
- Build feedback loops for model improvement
Features
- State-aware: Automatically highlights the submitted feedback button via
data-submitted - Zero wiring:
submitFeedbackis called by the underlying primitives — no callbacks needed - Customizable: Override classes, labels, and icons
- Accessible: Proper
aria-labelon each button
Props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Root container class |
positiveClassName | string | — | Thumbs up button class |
negativeClassName | string | — | Thumbs down button class |
iconClassName | string | — | Icon class for both icons |
positiveLabel | string | "Good response" | Aria-label for thumbs up |
negativeLabel | string | "Bad response" | Aria-label for thumbs down |
renderPositiveIcon | () => ReactNode | — | Custom thumbs up icon |
renderNegativeIcon | () => ReactNode | — | Custom thumbs down icon |
Basic Usage
import { FeedbackButtons } from "@assistant-ui/chords";
// Inside an assistant message
<MessagePrimitive.Root>
<MessagePrimitive.Content />
<FeedbackButtons />
</MessagePrimitive.Root>With MessageActionBar
<div className="flex items-center gap-2">
<MessageActionBar actions={["copy", "reload"]} />
<FeedbackButtons />
</div>Custom Labels
<FeedbackButtons
positiveLabel="Helpful"
negativeLabel="Not helpful"
/>Underlying Primitives
FeedbackButtons wraps:
ActionBarPrimitive.FeedbackPositive— callssubmitFeedback({ type: "positive" }), setsdata-submittedwhen positive feedback is activeActionBarPrimitive.FeedbackNegative— callssubmitFeedback({ type: "negative" }), setsdata-submittedwhen negative feedback is active
The data-submitted attribute is used for styling the active/highlighted state.