The score sits on a dial like a watch face. Tap, drag or use the arrow keys and a pointer moves round the arc while it fills to the score, and the big number in the middle changes with a soft blur. After a score, a follow-up question opens that fits the answer.
npx shadcn@latest add https://clickworks.dev/r/nps-survey.jsonThe files land in components/clickworks/nps-survey/. The CLI also installs motion.
"use client"
import { NPSSurvey } from "@/components/clickworks/nps-survey/react/NPSSurvey"
export function Feedback() {
return (
<NPSSurvey
onSubmit={(answer) => fetch("/api/feedback", { method: "POST", body: JSON.stringify(answer) }).then((r) => r.ok)}
/>
)
}Receives the answer when the survey isn't in a form. Return false or throw to keep it open.
The question and the line under it.
The words at both ends of the dial.
Default Not likely / Very likely
A follow-up question for each kind of score. null skips it.
What it says once it's sent.
Auto follows the page (its background, data-theme or dark class), then the device.
Default "auto"
Colours for each theme, including the Send button text.
Inside a form: the field names it submits under, and whether a score is required.
Default "nps" / true
Text on its own Send button.
Default "Send"
Colours come in through the light and dark props, and each layer of text can take its own font through typography.