npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@denis98/feedback-widget

v0.5.0

Published

Lightweight, open-source feedback widget for React: bug/feature/general feedback with pixel-perfect region screenshots, in-browser annotation, and webhook-based ticket integration.

Readme

@denis98/feedback-widget

npm version CI License: MIT

Lightweight, open-source feedback widget for React. Users report bugs, request features, or leave general feedback — optionally with pixel-perfect screenshots (full page, a clicked element, or a freely drawn region), which they can annotate right in the browser. Submissions are delivered to any webhook (e.g. a ticket system).

Features

  • 🎯 Flexible selection — click a single element, drag a region over several components, pick a registered zone, or capture the full screen.
  • 🖼 Pixel-perfect screenshots — Screen Capture API cropped to the selection, with a modern-screenshot DOM-render fallback (no permission required).
  • ✏️ Annotate — freehand pen + rectangle, colors, undo/clear, flattened into the image on save.
  • 🗂 Multiple screenshots per submission with an in-form gallery; add more via “Weiteres Bild”, even after navigating to another page.
  • 📝 Flexible form schema — declare your own fields; values map to the submitter (user) or arbitrary custom data.
  • ✉️ Contact + thank-you — optional name/email so you can follow up.
  • 🔌 Webhook delivery with retry, optional HMAC signing, and Zod-validated payloads. Zero UI dependencies (inline styles).

Install

npm install @denis98/feedback-widget

Peer dependencies: react and react-dom (>= 18).

Usage

import { FeedbackProvider } from '@denis98/feedback-widget';

export function App() {
  return (
    <FeedbackProvider
      webhookUrl="/api/feedback"
      selectionMode="pixel" // click an element OR drag a region
      screenshot
      collectContact // optional name + email fields
      user={{ id: '42', email: '[email protected]', name: 'Ada' }}
    >
      <YourApp />
    </FeedbackProvider>
  );
}

The provider renders a floating trigger button and the feedback modal. Pass a custom trigger render-prop to replace the button, or trigger={null} to drive the widget yourself via useFeedbackContext().

Selection modes

| Mode | Behaviour | | -------- | ---------------------------------------------------------------------- | | zone | Only <FeedbackZone> regions are selectable. | | pixel | Click an element or drag a free region. | | hybrid | Zones take priority; element/region selection applies everywhere else. | | region | Drag-to-select region only. | | none | Skip selection and open the form directly. |

When screenshot is enabled the selection bar also offers 🖥 Ganzer Bildschirm and Ohne Screenshot (text-only).

Screenshots

Capture strategy, tuned for fidelity — including a single selected region:

  1. Screen Capture API (getDisplayMedia + preferCurrentTab) grabs a real frame of the tab and crops it to the selection. Off-screen elements are scrolled into view first.
  2. modern-screenshot fallback (domToPng) when Screen Capture is unavailable or denied — no permission, lower fidelity.

Screenshots are delivered as base64 PNG data URLs (screenshots: string[], plus screenshot = the first, for backward compatibility).

Flexible form fields

<FeedbackProvider
  webhookUrl="/api/feedback"
  fields={[
    { name: 'name', label: 'Name', type: 'text', mapTo: 'name' },
    { name: 'email', label: 'E-Mail', type: 'email', mapTo: 'email' },
    {
      name: 'severity',
      label: 'Severity',
      type: 'select',
      options: [
        { value: 'low', label: 'Low' },
        { value: 'high', label: 'High' },
      ],
    },
  ]}
>
  {/* … */}
</FeedbackProvider>

mapTo fields go into payload.user; everything else into payload.custom.

To send known data (e.g. the logged-in user's contact) without showing an input, mark a field hidden and give it a defaultValue — it's submitted silently and skips validation:

fields={[
  { name: 'email', label: 'E-Mail', type: 'email', mapTo: 'email', hidden: true, defaultValue: user.email },
  { name: 'plan', label: 'Plan', hidden: true, defaultValue: user.plan },
]}

(For just the user's identity, the user prop already lands in payload.user with no fields at all.)

Localization

Two message packs ship built in: en (default) and de. Pick one with locale:

<FeedbackProvider webhookUrl="/api/feedback" locale="de">
  {/* … */}
</FeedbackProvider>

Override individual strings — or add a whole new language — with messages (deep-merged onto the chosen locale pack, so you only specify what changes):

<FeedbackProvider
  webhookUrl="/api/feedback"
  locale="de"
  messages={{
    form: { submit: 'Abschicken', heading: 'Feedback' },
    success: { heading: 'Vielen Dank!' },
  }}
>
  {/* … */}
</FeedbackProvider>

Interpolated strings use {token} placeholders (e.g. selection.region: "Area {width}×{height}"). The full Messages type, the built-in packs (builtinMessages) and the resolveMessages / format helpers are exported for building a complete custom language:

import { builtinMessages, type Messages, type DeepPartial } from '@denis98/feedback-widget';

const fr: DeepPartial<Messages> = { trigger: { open: 'Retour' }, form: { submit: 'Envoyer' } };

Two display-only flags let you hide elements that are redundant in your setup (the data is still transmitted): showType={false} (type chosen via the hover trigger) and showUrl={false} (page URL stays in context.url and the description).

Webhook payload

interface WebhookPayload {
  projectId: string;
  feedbackId: string; // UUID
  type: 'bug' | 'feature' | 'general';
  title: string;
  description: string;
  zone: ZoneInfo | null;
  context: { url; userAgent; viewport; timestamp; locale }; // url = affected page, captured when the widget opened
  user: { id?; email?; name? } | null;
  screenshot: string | null; // data:image/png;base64,…  (= screenshots[0])
  screenshots: string[];
  custom: Record<string, unknown>;
}

The submitter's name/email (from the user prop or mapTo fields) and the affected page URL are also appended to description as plain lines (Name: …, Email: …, Page: …), so they show up in ticket text even if your sink only renders the description. They remain available structured in user / context.url too.

Return a WebhookResponse ({ ticketId?, ticketUrl?, message? }) to show a confirmation linking to the created ticket. Set secret to sign the body (X-Feedback-Signature, HMAC-SHA256). formatters (toMarkdown, toPlainText, toHTML) help render the payload server-side.

Development

npm run dev            # tsup watch build
npm test               # vitest
npm run typecheck      # tsc --noEmit
npm run build          # bundle to dist/ (deps externalized)
npm run build:vendored # self-contained bundle (zod + modern-screenshot inlined)
npm run storybook      # interactive playground

License

MIT © Denis Graipel