Feedback Widget
New"Was this helpful?" with faces or thumbs, an optional comment and a thank-you.
Was this page helpful?
Did this answer your question?
Nothing is sent anywhere in this example.
Installation
$ pnpm dlx shadcn@latest add @synccn/feedback-widgetFirst time in this project? Connect synccn with one command.
Usage
import { FeedbackWidget } from "@/components/ui/feedback-widget";<FeedbackWidget onSubmit={(f) => send(f)} />API reference
Generated from the component's TypeScript types, so it always matches the code.
FeedbackWidget
"Was this helpful?" for docs and help pages: pick a face, optionally say why, and get a thank-you. The comment box only opens after a rating, so it stays out of the way.
- question
stringDefault
"Was this page helpful?"The question.
- onSubmitrequired
(feedback: { rating: number; comment: string }) => unknownCalled when the person sends feedback. Return a promise to show "Sending…".
- variant
"emoji" | "thumbs"Default
"emoji""emoji" shows four faces; "thumbs" shows yes and no.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Check
Accessibility
- Ratings are a radiogroup with a label for each option, and the thank-you is a status message.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: radio, radiogroup, status
- ARIA attributes: aria-checked, aria-label, aria-labelledby
- Shows a visible focus ring for keyboard users
- Announces changes to screen readers