Docs
Components
Survey

The Survey Component

<Survey> collects structured user feedback (NPS/CSAT/CES/custom) with trigger rules and cooldowns.

Usage

nps-survey.tsx
import { Survey } from 'featuredrop/react'
 
<Survey
  id="post-launch-nps"
  type="nps"
  trigger="manual"
  prompt="How likely are you to recommend FeatureDrop?"
  onSubmit={async (payload) => {
    await fetch('/api/surveys', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload)
    })
  }}
>
  {({ show }) => (
    <button onClick={() => show({ force: true })}>Open survey</button>
  )}
</Survey>

Key props

PropTypeNotes
idstringRequired survey id
type'nps' | 'csat' | 'ces' | 'custom'Survey scale
trigger'auto' | 'manual'Show mode
triggerRulesSurveyTriggerRulesPage/usage/time/sample gating
questionsSurveyQuestion[]Optional custom questions
onSubmit(payload) => Promise<void> | voidRequired submit handler

Keep surveys short and tied to meaningful moments (post-feature use, not first page load).

Interactive Demo