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

microfeedback-react

v0.1.5

Published

React SDK for embedding MicroFeedback widgets

Readme

MicroFeedback React

React components for embedding MicroFeedback widgets in your application.

Installation

npm install microfeedback-react
# or
yarn add microfeedback-react
# or
pnpm add microfeedback-react
# or
bun add microfeedback-react

Quick Start

Basic Usage

import { MicroFeedbackWidget } from 'microfeedback-react';

function App() {
  return (
    <div>
      <h1>My App</h1>
      <MicroFeedbackWidget
        apiKey="your-api-key"
        widgetId="your-widget-id"
        baseUrl="http://localhost:3000/embed" // Your MicroFeedback server URL
        theme="auto"
        position="bottom-right"
        onLoad={() => console.log('Widget loaded')}
        onSubmit={(data) => console.log('Feedback submitted:', data)}
      />
    </div>
  );
}

With Provider (for multiple widgets)

import { MicroFeedbackProvider, MicroFeedbackWidget } from 'microfeedback-react';

function App() {
  return (
    <MicroFeedbackProvider
      apiKey="your-api-key"
      baseUrl="http://localhost:3000/embed"
      theme="auto"
    >
      <div>
        <h1>My App</h1>
        <MicroFeedbackWidget
          widgetId="widget-1"
          position="bottom-right"
        />
        <MicroFeedbackWidget
          widgetId="widget-2"
          position="bottom-left"
        />
      </div>
    </MicroFeedbackProvider>
  );
}

Props

MicroFeedbackWidget

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | apiKey | string | Yes* | - | Your MicroFeedback API key | | widgetId | string | Yes | - | The widget ID to display | | baseUrl | string | Yes* | - | Your MicroFeedback server URL | | theme | "light" \| "dark" \| "auto" | No | "auto" | Widget theme | | position | "bottom-right" \| "bottom-left" \| "top-right" \| "top-left" | No | "bottom-right" | Widget position | | onLoad | () => void | No | - | Called when widget loads | | onError | (error: EmbedError) => void | No | - | Called when an error occurs | | onSubmit | (data: { feedback: string }) => void | No | - | Called when feedback is submitted | | onShow | () => void | No | - | Called when widget is shown | | onHide | () => void | No | - | Called when widget is hidden | | initiallyVisible | boolean | No | true | Whether widget should be visible initially |

*Required unless provided via MicroFeedbackProvider

MicroFeedbackProvider

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | apiKey | string | Yes | - | Your MicroFeedback API key | | baseUrl | string | Yes | - | Your MicroFeedback server URL | | theme | "light" \| "dark" \| "auto" | No | "auto" | Default theme for all widgets | | onError | (error: EmbedError) => void | No | - | Global error handler |

Examples

Next.js App Router

// app/page.tsx
'use client';

import { MicroFeedbackWidget } from 'microfeedback-react';

export default function HomePage() {
  return (
    <main>
      <h1>Welcome to my app</h1>
      <MicroFeedbackWidget
        apiKey="mk_dev_your_api_key"
        widgetId="your_widget_id"
        baseUrl="http://localhost:3000/embed"
        onSubmit={(data) => {
          console.log('Feedback received:', data.feedback);
        }}
      />
    </main>
  );
}

Next.js Pages Router

// pages/index.tsx
import { MicroFeedbackWidget } from 'microfeedback-react';

export default function HomePage() {
  return (
    <div>
      <h1>Welcome to my app</h1>
      <MicroFeedbackWidget
        apiKey="mk_dev_your_api_key"
        widgetId="your_widget_id"
        baseUrl="http://localhost:3000/embed"
      />
    </div>
  );
}

Vite + React

// src/App.tsx
import { MicroFeedbackWidget } from 'microfeedback-react';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <h1>My Vite App</h1>
      </header>
      <MicroFeedbackWidget
        apiKey="mk_dev_your_api_key"
        widgetId="your_widget_id"
        baseUrl="http://localhost:3000/embed"
        theme="dark"
        position="top-right"
      />
    </div>
  );
}

export default App;

Troubleshooting

Widget not loading

  1. Check the console for errors - The widget will log detailed error information
  2. Verify your API key - Make sure it's correct and has the right permissions
  3. Check the baseUrl - Ensure it points to your MicroFeedback server
  4. Verify the widget ID - Make sure the widget exists and is enabled

Common Issues

"Failed to connect to MicroFeedback API"

  • Check that your server is running
  • Verify the baseUrl is correct
  • Check for CORS issues

"Invalid API key"

  • Verify your API key is correct
  • Check that the API key has permission to access the widget

"Widget not found"

  • Verify the widget ID is correct
  • Check that the widget is enabled for embedding

TypeScript Support

This package includes full TypeScript definitions. All components and hooks are fully typed.

import type { EmbedError, EmbedConfig } from 'microfeedback-react';

const handleError = (error: EmbedError) => {
  console.error('Widget error:', error.message, error.code);
};

License

MIT