OfferLifetime Pro for $99

Feedback Widget

Asks one question on one of four scales, each a real radio group. With a follow-up prompt a comment box opens after the score, with Skip and Send; without one the score sends when picked. A failed send keeps what was typed, and the floating variant opens from a small Feedback button.

Data & feedbackFree309 lines · one file

The decision inside it

Picking a score is not sending it

When there is a follow-up, the score waits for the comment or for Skip, so someone who changes their mind on the scale is not recorded twice.

When to use it

Use Feedback Widget to ask one question: type nps for recommending, emoji for how something felt, thumbs for useful or not, stars for a rating. Add followUp for an optional comment, and variant "floating" for a corner button that opens it.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Feedback Widget for this.
Install it: npx shadcn@latest add @layro/feedback-widget
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/feedback-widget.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

components/nps-survey.tsx
import { FeedbackWidget } from "@/components/ui/feedback-widget";

export function NpsSurvey() {
  return (
    <FeedbackWidget
      type="nps"
      question="How likely are you to recommend us to a colleague?"
      followUp="What is the main reason for your score?"
      onSubmit={(value) => fetch("/api/feedback", { method: "POST", body: JSON.stringify(value) })}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
typeFeedbackTypeDefault "nps".
questionrequiredstring—
followUpstringThe prompt for an optional comment after the score.
onSubmitrequired(value: FeedbackValue) => void | Promise<unknown>—
variant"card" | "floating"Default "card".
faces"emoji" | "icons"For type "emoji": colour emoji (default) or line icons that take the text colour.
thanksstringThe thank-you line.
classNamestring—

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-themebuttonstar-ratingtextarea

States

All of them are drawn by the component. None is left for you to design.

  • NPS
  • Emoji
  • Thumbs
  • Stars
  • Floating

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.