Components
NPS survey
NativeA 0–10 recommendation score with a contextual follow-up and submission feedback.
Installation
npx nook-ui@latest add nps-surveyPrompt
Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.
Short. For assistants that can run commands in your project.
Add the Nook "NPS survey" component to this project, exactly as Nook ships it.
A 0–10 recommendation score with a contextual follow-up and submission feedback.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add nps-survey`. It writes `components/ui/nps-survey.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/nps-survey.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
import { NpsSurvey } from "@/components/ui/nps-survey";
export default function Example() {
return (
<NpsSurvey
className="w-full"
question="How likely are you to recommend Studio North to a teammate?"
/>
);
}
```
API
- `NpsSurvey`: A 0–10 recommendation score with a contextual follow-up and submission feedback.
- `value / defaultValue` (`number | null`): Recommendation score from 0 to 10.
- `onValueChange` (`(score: number) => void`): Receives score changes.
- `onSubmit` (`(response: { score: number; comment: string }) => void`): Receives completed feedback.
- `question` (`string`): Survey question.
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Native radios share a named fieldset and arrow-key navigation; selection is visible and checked.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { NpsSurvey } from "@/components/ui/nps-survey";
export default function Example() {
return (
<NpsSurvey
className="w-full"
question="How likely are you to recommend Studio North to a teammate?"
/>
);
}Examples
Prefilled score
Already answered
Support follow-up
Inside a card
Props
NpsSurvey
A 0–10 recommendation score with a contextual follow-up and submission feedback.
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | number | null | – | Recommendation score from 0 to 10. |
| onValueChange | (score: number) => void | – | Receives score changes. |
| onSubmit | (response: { score: number; comment: string }) => void | – | Receives completed feedback. |
| question | string | – | Survey question. |
Accessibility
Native radios share a named fieldset and arrow-key navigation; selection is visible and checked.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.