Usage
import { DocsFeedback } from './DocsFeedback.jsx'
// Post the answer to your feedback route; resolve false to show the error and keep the answer.
// After Yes, a tap on what helped most is sent again with followUp: true.
<DocsFeedback
locale="en"
onSend={async (answer) => { // { helpful, reasons, comment, followUp? }
const res = await fetch('/api/feedback', { method: 'POST', body: JSON.stringify({ page: slug, ...answer }) })
return res.ok
}}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | Language of the built-in text and reasons. |
reasons | Array<{ value, label }> | sample reasons | The reasons offered after No. An empty array leaves only the comment. |
liked | Array<{ value, label }> | sample answers | What could have helped, offered after Yes; a tap sends { helpful: true, reasons: [value], followUp: true }. An empty array hides the follow-up. |
links | Array<{ label, href, icon? }> | sample links | Other ways to help, in the foot beside the "updated" line (labels.updated). An empty array hides them. |
maxLength | number | 500 | Longest comment, shown as a count under the field. |
defaultValue | 'yes' | 'no' | null | null | The answer it starts with; "no" opens the form. |
loading / error | boolean / boolean | string | false | Show the skeleton, or the error banner with "Send again" (a string replaces its sentence). |
onSend / onRetry | (answer) => Promise<boolean | void> / () => void | — | Sends { helpful, reasons, comment }; resolve false (or throw) to show the error. onRetry runs before sending again. |
labels | object | — | Replaces any built-in text (keys as in copy.js). |
Add it to your project
Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the block together with the components it is built from.
DocsFeedback.jsxdocs-feedback.csscopy.jskit.jsxkit.cssui/base-button/ui/two-step-button/ui/alert-banner/ui/success-check/ui/chip-group/ui/textarea/ui/skeleton-shimmer/tokens.cssREADME.md
The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.