Updated
Effort Dial
NewCustomize
Colors
Width360px
Installation
npx shadcn@latest add https://uibrik.com/r/effort-dial.jsonInstall the packages
npm install @tabler/icons-react motion react-use-measureAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/effort-dial/effort-dial.tsx"use client"; import { IconLoader2 } from "@tabler/icons-react"; import { animate, AnimatePresence, motion, useInView, useMotionValue, useMotionValueEvent, useReducedMotion, useTransform, type Variants, } from "motion/react"; import { useEffect, useId, useRef, useState, type KeyboardEvent, type PointerEvent } from "react"; import useMeasure from "react-use-measure"; import { cn } from "@/lib/utils"; // A gauge for customer effort. The scale runs as one gradient from easiest to // hardest: faint along the whole arc, solid from the start up to the knob. The // knob follows the pointer exactly, ticks light as it passes, and on release it // settles into the middle of the nearest answer, like a dial with detents. const EASE_OUT: [number, number, number, number] = [0.23, 1, 0.32, 1]; const SETTLE = { type: "spring", duration: 0.45, bounce: 0.12 } as const;
Adds the files to
components/uibrik/effort-dial and installs @tabler/icons-react, motion and react-use-measure. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/effort-dial.Usage
import { EffortDial } from "@/components/uibrik/effort-dial/effort-dial";const labels = ["Very easy", "Easy", "Okay", "Hard", "Very hard"];const colors = ["#16a35a", "#84cc16", "#eab308", "#f97316", "#e5484d"];<EffortDial prompt="How easy was it to get set up?" labels={labels} colors={colors} hardPrompt="What got in the way?" width={360} defaultValue={null} submitLabel="Send" thanksLabel="Thanks, that helps" onSubmit={(feedback) => {}} // value={0} // onChange={(score) => {}}/>Where to use Effort Dial
Setup and onboarding
Asking how easy it was right after setup catches friction while it's fresh.
Support resolutions
A customer effort score after a ticket closes tracks how hard help was to get.
Checkout and forms
A hard answer opens a note, so the score comes with the reason behind it.
Pairs with NPS Strip
Props
EffortDial- prompt
- Type string
- "How easy was it to get set up?"
- The question above the dial.
- labels
- Type string[]
- ["Very easy","Easy","Okay","Hard","Very hard"]
- One answer per segment, easiest first. Three to seven.
- colors
- Type string[]
- ["#16a35a","#84cc16","#eab308","#f97316","#e5484d"]
- Gradient stops from easiest to hardest.
- hardPrompt
- Type string
- "What got in the way?"
- Asked when the answer is one of the two hardest. Empty skips it.
- width
- Type number
- 360
- Width of the card; never wider than its container.
- value / onChange
- Type number | null / (score) => void
- –
- Controlled answer, 1 for the easiest, null for none.
- defaultValue
- Type number | null
- null
- Answer on mount when uncontrolled.
- onSubmit
- Type (feedback: { score, label, comment }) => void | Promise
- –
- Called when sent. Return a promise to hold the button in a sending state; a rejection keeps the card open.
- submitLabel / thanksLabel
- Type string
- –
- Send button text and the line shown once sent.
- className
- Type string
- –
- Classes for the wrapper.