195 Pro components and page blocks

Get Pro

Updated

NPS Strip

New

Preview

Customize

Colors
Width460px

Installation

npx shadcn@latest add https://uibrik.com/r/nps-strip.json
Adds the files to components/uibrik/nps-strip and installs @tabler/icons-react, motion and react-use-measure. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/nps-strip.

Usage

import { NpsStrip } from "@/components/uibrik/nps-strip/nps-strip";​const prompt = "How likely are you to recommend us to a friend?";​const followUps = ["What would have made it better?", "What would make it a 10?", "What do you love most?"];​<NpsStrip  prompt={prompt}  lowLabel="Not likely"  highLabel="Very likely"  colors={["#e5484d", "#e8890c", "#16a35a"]}  width={460}  defaultValue={null}  segmentLabels={["Detractor", "Passive", "Promoter"]}  followUps={followUps}  placeholder="Tell us a little more"  submitLabel="Send"  thanksLabel="Thanks for the feedback"  onSubmit={(feedback) => {}}  // value={0}  // onChange={(score) => {}}/>

Where to use NPS Strip

  • Quarterly NPS surveys

    The whole survey is one card, and each group is asked the question that matters for it.

  • In-app feedback prompts

    Eleven scores fit a phone-width card without wrapping or scrolling.

    Pairs with Toast

  • Post-onboarding check

    The coloured band shows people which group their score falls in as they pick.

Props

NpsStrip
prompt
Type string
"How likely are you to recommend us to a friend?"
The question above the scores.
lowLabel
Type string
"Not likely"
Word under 0.
highLabel
Type string
"Very likely"
Word under 10.
colors
Type string[]
["#e5484d","#e8890c","#16a35a"]
Colour of detractors (0 to 6), passives (7 to 8) and promoters (9 to 10).
width
Type number
460
Width of the card; never wider than its container.
value / onChange
Type number | null / (score) => void
–
Controlled score from 0 to 10, null for none.
defaultValue
Type number | null
null
Score on mount when uncontrolled.
segmentLabels
Type [string, string, string]
["Detractor", "Passive", "Promoter"]
Name of each group, shown as a chip once picked.
followUps
Type [string, string, string]
–
Follow-up question for each group.
onSubmit
Type (feedback: { score, segment, comment }) => void | Promise
–
Called when sent. Return a promise to hold the button in a sending state; a rejection keeps the card open.
placeholder / submitLabel / thanksLabel
Type string
–
Note placeholder, send button text and the line shown once sent.
className
Type string
–
Classes for the wrapper.