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

@ze-org/ze-feedback

v0.1.0

Published

Lightweight, type-safe feedback widget

Downloads

6

Readme

@ze/ze-feedback

A lightweight, type-safe feedback widget for React apps. Built with Radix UI, Zod, and Tailwind v4.

Why use it?

  • Type-safe payload with Zod validation
  • Accessible dialog (Radix UI)
  • Optional 1–5 star rating
  • Tiny API, sensible defaults, themeable
  • CSS auto-included (no extra imports)

Installation

npm install @ze/ze-feedback
# peer deps (if you don't already have them)
npm install react react-dom

Quick start

import { FeedbackWidget } from "@ze/ze-feedback";

export default function App() {
  return <FeedbackWidget apiUrl="/api/feedback" />;
}

The styles are included automatically from the package entrypoint.

Props

type Theme = "light" | "dark";

interface FeedbackWidgetProps {
  apiUrl: string; // required: POST endpoint for feedback
  userId?: string; // optional user identifier
  metadata?: Record<string, any>; // optional extra context
  onSuccess?: () => void; // called after successful submission
  onError?: (err: Error) => void; // called when submission fails
  theme?: Theme; // visual theme of the widget (default: "light")

  // Optional toast renderer. If provided, your element replaces the default toast.
  // Example signature: (info) => <MyToast type={info.type} message={info.message} />
  renderToast?: (info: {
    type: "success" | "error";
    message: string;
  }) => React.ReactNode;

  // Trigger button appearance
  // - "standAlone": circular pill with strong contrast (default)
  // - "simple": minimal button that inherits surrounding context
  buttonVariant?: "standAlone" | "simple";

  // Optional custom icon for the trigger button (primarily for simple variant)
  buttonIcon?: React.ReactNode;
}

Behavior

  • Clicking the trigger opens an accessible modal titled “Send Feedback”.
  • The form contains a textarea and an optional 1–5 star rating.
  • On submit:
    • Payload is validated with Zod.
    • A POST request is sent to apiUrl.
    • On success: dialog closes immediately, a short success toast appears, onSuccess is called.
    • On failure: an error toast appears, onError is called with the Error instance.
  • The payload automatically includes createdAt (ISO string), plus any userId/metadata you provide.

Payload shape (sent to apiUrl)

{
  feedback: string;              // 1–2000 chars
  rating?: number;               // 1–5
  userId?: string;               // optional
  metadata?: Record<string, any>;// optional
  createdAt: string;             // ISO 8601
}

You can also import the schema and types:

import { feedbackPayloadSchema } from "@ze/ze-feedback";
import type { FeedbackPayload, FeedbackWidgetProps } from "@ze/ze-feedback";

Examples

Minimal

<FeedbackWidget apiUrl="/api/feedback" />

With metadata and hooks

<FeedbackWidget
  apiUrl="/api/feedback"
  userId="user-123"
  metadata={{ page: "/dashboard", plan: "pro" }}
  onSuccess={() => console.log("Thanks!")}
  onError={(e) => console.error(e)}
/>

Dark theme

<FeedbackWidget apiUrl="/api/feedback" theme="dark" />

Custom toast

<FeedbackWidget
  apiUrl="/api/feedback"
  renderToast={({ type, message }) => (
    <div
      style={{
        position: "fixed",
        top: 16,
        right: 16,
        padding: "10px 14px",
        borderRadius: 8,
        color: "#fff",
        background: type === "success" ? "#16a34a" : "#ef4444",
        boxShadow: "0 6px 18px rgba(0,0,0,.2)",
        zIndex: 9999,
      }}
      role="alert"
    >
      {message}
    </div>
  )}
/>

Button variants

// Standalone (default): circular, high contrast
<FeedbackWidget apiUrl="/api/feedback" />

// Simple: minimal button (inherits context)
<FeedbackWidget
  apiUrl="/api/feedback"
  buttonVariant="simple"
  buttonIcon={<YourIcon className="w-4 h-4" />}
/>

Backend example

Express-style handler:

app.post("/api/feedback", async (req, res) => {
  const result = feedbackPayloadSchema.safeParse(req.body);
  if (!result.success) {
    return res
      .status(400)
      .json({ error: "Invalid feedback data", details: result.error.errors });
  }

  // persist result.data ...
  return res.json({ ok: true });
});

Notes

  • This package treats react and react-dom as peer dependencies.
  • When developing locally via npm link with Vite/Next:
    • Make sure there is only one copy of React loaded.
    • In Vite, set resolve.dedupe = ['react','react-dom'].
    • In Next, set transpilePackages: ['@ze/ze-feedback'].

License

MIT