FeedbackWidget
Betafunction FeedbackWidget(props: FeedbackWidgetProps): JSX.Element| Param | Type | Required | Description |
|---|---|---|---|
| props.requestId | string | Required | The LLM call's gateway requestId. Server-side validation requires this. |
| props.endpoint | string | Optional | Submit URL. Defaults to '/api/feedback'. |
| props.fetchImpl | typeof fetch | Optional | Custom fetch (for testing or SSR). |
| props.onSuccess | (entry: FeedbackEntry) => void | Optional | Called after a successful submission with the validated entry returned by the server. |
| props.onError | (error: Error) => void | Optional | Called when validation or network fails. |
| props.promptLabel | string | Optional | Label above the rating row. Defaults to 'How was this answer?'. |
| props.thanksLabel | string | Optional | Replacement content shown after submit. Defaults to 'Thanks for the feedback.'. |
| props.commentPlaceholder | string | Optional | Placeholder for the optional comment textarea. |
| props.submitLabel | string | Optional | Submit button label. Defaults to 'Send'. |
| props.showComment | boolean | Optional | Show the comment textarea. Defaults to true. |
| props.className | string | Optional | Forwarded to the root form element. |
| props.style | CSSProperties | Optional | Forwarded to the root form element. |
import { FeedbackWidget } from "@luxoai-dev/feedback-ui";
export function TriageFeedback({ requestId }: { requestId: string }) {
return (
<FeedbackWidget
requestId={requestId}
promptLabel="Was this triage useful?"
submitLabel="Submit feedback"
onSuccess={(entry) => console.log("recorded", entry.requestId)}
onError={(err) => console.error(err)}
/>
);
}