Survey Components
CSAT5 (Customer Satisfaction Score, 5-Point Scale)
Surveys to ask users about their overall satisfaction.
Example questions:
- "How satisfied are you with our product?"
- "How would you rate your overall experience?"
- "How satisfied are you with our customer support?"
import { CSAT5Survey } from 'react-feedback-surveys';
import 'react-feedback-surveys/index.css';
<CSAT5Survey
scaleStyle="emoji"
question="How would you rate your satisfaction with our product?"
minLabel="Very unsatisfied"
maxLabel="Very satisfied"
responseType="text"
textQuestion="We'd love to hear your thoughts — what can we improve?"
textButtonLabel="Send"
thankYouMessage="Thanks for your feedback!"
onScoreSubmit={({ value }) => {/* ... */}}
onFeedbackSubmit={({ value, comment }) => {/* ... */}}
/>scaleStyle: emoji | numbers | stars.
CSAT2 (Customer Satisfaction Score, 2-Point Scale)
Surveys to ask users about specific features or flows.
Example questions:
- "Was this search helpful?"
- "Did you find what you were looking for?"
- "Are you satisfied with the checkout process?"
import { CSAT2Survey } from 'react-feedback-surveys';
import 'react-feedback-surveys/index.css';
<CSAT2Survey
scaleStyle="thumbs"
question="Are you satisfied with the result?"
responseType="text"
textQuestion="We'd love to hear your thoughts — what can we improve?"
textButtonLabel="Send"
thankYouMessage="Thank you for your feedback!"
onScoreSubmit={({ value }) => {/* ... */}}
onFeedbackSubmit={({ value, comment }) => {/* ... */}}
/>scaleStyle: emoji | thumbs.
NPS10 (Net Promoter Score, 0–10 Scale)
Surveys to ask users if they'd recommend your product.
Example questions:
- "How likely are you to recommend us to a friend or colleague?"
- "On a scale of 0-10, would you recommend our service?"
- "How likely are you to recommend this product to others?"
import { NPS10Survey } from 'react-feedback-surveys';
import 'react-feedback-surveys/index.css';
<NPS10Survey
scaleStyle="numbers"
question="How likely are you to recommend our product/service to a friend or colleague?"
minLabel="Very unlikely"
maxLabel="Very likely"
responseType="text"
textQuestion="We'd love to hear your thoughts — what can we improve?"
textButtonLabel="Send"
thankYouMessage="Thank you for your feedback!"
onScoreSubmit={({ value }) => {/* ... */}}
onFeedbackSubmit={({ value, comment }) => {/* ... */}}
/>scaleStyle: numbers.
CES7 (Customer Effort Score, 7-Point Scale)
Surveys to ask users how easy it is to use your product.
Example questions:
- "How easy was it to complete your task?"
- "How much effort did it take to resolve your issue?"
- "How easy was it to sign up for an account?"
import { CES7Survey } from 'react-feedback-surveys';
import 'react-feedback-surveys/index.css';
<CES7Survey
scaleStyle="numbers"
question="How easy was it to complete your task?"
minLabel="Very difficult"
maxLabel="Very easy"
responseType="text"
textQuestion="We'd love to hear your thoughts — what can we improve?"
textButtonLabel="Send"
thankYouMessage="Thank you for your feedback!"
onScoreSubmit={({ value }) => {/* ... */}}
onFeedbackSubmit={({ value, comment }) => {/* ... */}}
/>scaleStyle: numbers.
Layout Components
Popup
The <Popup> component wraps survey widgets in a fixed overlay that slides in from the screen edge. It includes positioning, animations, and a close button for easy dismissal.
Usage
import { Popup, CSAT5Survey } from 'react-feedback-surveys';
import 'react-feedback-surveys/index.css';
<Popup
animated
classNames={{
base: 'custom-popup-base',
content: 'custom-popup-content',
close: 'custom-popup-close'
}}
placement="bottomRight"
onClose={() => console.log('Closed')}
>
<CSAT5Survey
scaleStyle="stars"
question="How would you rate your satisfaction?"
onScoreSubmit={({ value }) => {/* ... */}}
/>
</Popup>Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
placement | 'topLeft' 'topRight' 'bottomRight' 'bottomLeft' | - | 'bottomRight' | Position of the popup relative to the screen edges. |
animated | boolean | - | true | Enables a fade-in animation when the popup appears. |
className | string | - | - | Additional CSS class name for the popup container. |
classNames | { base?: string; content?: string; close?: string } | - | - | Optional class names for internal popup elements. |
children | React.ReactNode | - | - | Content to render inside the popup (typically a survey component). |
onClose | () => void | - | - | Callback fired when the close button is clicked. |
For more examples, check out the Storybook stories (e.g., CSAT5Survey.stories.tsx, CSAT2Survey.stories.tsx).
Surface
The <Surface> component is a basic container wrapper that provides consistent styling for survey content. It's used internally by the Popup component and can be used standalone to display surveys with a card-like appearance.
The Surface component provides:
- Background color with depth/elevation (box shadow)
- Rounded corners (8px border radius)
- Responsive padding that adapts to mobile devices
Usage
import { Surface, CSAT5Survey } from 'react-feedback-surveys';
import 'react-feedback-surveys/index.css';
<Surface className="custom-surface">
<CSAT5Survey
scaleStyle="stars"
question="How would you rate your satisfaction?"
onScoreSubmit={({ value }) => {/* ... */}}
/>
</Surface>Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
className | string | - | - | Additional CSS class name for the surface container. |
children | React.ReactNode | - | - | Content to render inside the surface. |
The Surface component uses the --ft-surface-padding and --ft-surface-padding-mobile CSS variables for responsive padding.
Props
Most props are shared across all survey widgets. Each widget differs only in its scaleStyle values.
Shared Props
| Prop | Type | Required | Description |
|---|---|---|---|
classNames | { base?: { base?: string; head?: string; title?: string; body?: string; close?: string }; scale?: { base?: string; list?: string; button?: string; icon?: string; score?: string; labels?: string } } | - | Optional class names to target internal parts. |
question | string | required | Main survey question displayed on the first screen. |
minLabel | string | - | Left label for the scale. |
maxLabel | string | - | Right label for the scale. |
responseType | null | 'text' | 'choices' | - | Enables optional follow-up feedback. |
textQuestion | string | - | Follow-up question displayed when responseType is defined. |
textButtonLabel | string | - | Submit label for the feedback screen. |
choiceOptions | string[] | null | - | Predefined choices (when responseType === 'choices'). |
thankYouMessage | string | required | Message shown after submission. |
Shared Events
| Prop | Type | Required | Description |
|---|---|---|---|
onScoreSubmit | ({ value: number }) => void | Promise<void> | - | Fires immediately when a score is selected, before any follow-up feedback screen. Captures the raw rating. |
onFeedbackSubmit | ({ value: number; comment?: string | string[] }) => void | Promise<void> | - | Fires when feedback is submitted. Includes the selected score and the user’s comment(s). |
Event behavior
onScoreSubmit
Invoked immediately when the user selects a score on the rating scale. This callback runs before any optional follow-up screen is shown.
Use it to persist the rating instantly.
The actual value returned depends on the survey type:
- CSAT2:
0–1 - CSAT5:
1–5 - CES7:
1–7 - NPS10:
0–10
onFeedbackSubmit
Invoked when the user completes the follow-up step and submits their feedback (only applies when responseType is text or choices).
This callback provides both the original score and the user's input.
Arguments:
value: number— the same score previously passed toonScoreSubmitcomment: string | string[]— depends onresponseType:text: a single text commentchoices: an array of selected options (may include a free-text comment if enabled)
Important You should listen to both
onScoreSubmitandonFeedbackSubmit. A user may select a score but abandon the follow-up screen (close the widget, navigate away, refresh, etc.). Handling both events ensures you capture at least the rating even when additional feedback is not provided, and still receive extended data when it is.
Scale Style Options
Each survey type supports specific scale styles for displaying the rating interface:
CSAT2Survey
| Prop | Type | Required | Description |
|---|---|---|---|
scaleStyle | 'emoji' | 'thumbs' | required | Emoji mood scale style (happy/sad faces) or thumbs up/down emoji scale style. |
CSAT5Survey
| Prop | Type | Required | Description |
|---|---|---|---|
scaleStyle | 'emoji' | 'numbers' | 'stars' | required | Emoji scale style (5 emotion levels), numeric scale style (1–5), or star rating scale style (1–5 stars). |
CES7Survey
| Prop | Type | Required | Description |
|---|---|---|---|
scaleStyle | 'numbers' | required | Numeric scale style (1–7). |
NPS10Survey
| Prop | Type | Required | Description |
|---|---|---|---|
scaleStyle | 'numbers' | required | Numeric scale style (0–10). |
Note: The numeric ranges are defined by the widget (e.g., CSAT5 uses a 1–5 scale, NPS10 uses 0–10).
Demo
- Live demo: View Storybook
- Run locally:
npm run storybook
Credits
Emoji icons used in this package are from Sensa Emoji. Thanks to the Sensa team for creating such a great set of expressive icons.