Feedback Form
A compact sentiment and comment block. A row of five faces reveals an optional comment field once one is picked, then submits. It owns its rating and message state; wire onSubmit to your sink.
Installation#
Usage#
usage.tsxTSX
"use client"
import { FeedbackForm, type FeedbackFormData } from "@/components/ui/feedback-form"
export function Example() {
async function record({ rating, message }: FeedbackFormData) {
await fetch("/api/feedback", { method: "POST", body: JSON.stringify({ rating, message }) })
}
return <FeedbackForm onSubmit={record} />
}API reference#
FeedbackForm
Composes a single-select Toggle Group and a Textarea. Forwards all <div> props.
onSubmit:(data: { rating, message }) => void | Promise<void>. Rating is the chosen value"1"-"5".title,description,action: override the default copy.