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

leadforward-feedback-widget

v1.5.0

Published

React component for embedding Leadforward feedback widget

Readme

leadforward/widget-react

React component for embedding Leadforward feedback widget in your React applications.

Preview

LeadForward Widget Preview

Installation

npm install leadforward/widget-react

Usage

import { LeadForwardWidget } from 'leadforward/widget-react';

function App() {
  return (
    <div>
      {/* Your app content */}
      
      <LeadForwardWidget 
        config={{
          projectId: 'your-project-id',
          email: '[email protected]', // optional - can be set later with setEmail()
          position: 'bottom-right', // optional
          theme: 'auto', // optional
          primaryColor: '#6366f1', // optional
        }}
      />
    </div>
  );
}

Usage without initial email

You can also initialize the widget without an email and set it later:

import { LeadForwardWidget, setEmail } from 'leadforward/widget-react';

function App() {
  // Initialize widget without email
  return (
    <div>
      <LeadForwardWidget 
        config={{
          projectId: 'your-project-id',
          // No email provided initially
          position: 'bottom-right',
          theme: 'auto',
          primaryColor: '#6366f1',
        }}
      />
    </div>
  );
}

// Later, when user logs in:
// setEmail('[email protected]');

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | projectId | string | required | Your Leadforward project ID | | email | string | undefined | User's email address for feedback attribution (can be set later with setEmail()) | | position | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | 'bottom-right' | Widget position on screen | | theme | 'light' \| 'dark' \| 'auto' | 'auto' | Widget theme | | primaryColor | string | '#6366f1' | Primary color for buttons and accents | | hideRoadmap | boolean | false | Hide the "View Roadmap" button | | hideBugReport | boolean | false | Hide the "Bug Report" option | | hideInPaths | string[] | [] | Array of URL paths where the widget should be hidden | | customLabels | object | {} | Custom labels for buttons | | apiBase | string | https://leadforward.one | API base URL (for custom deployments) |

Dynamic Email Setting

If you need to set the user's email dynamically (e.g., after user login), you can import and use the email management functions directly from the package:

import { setEmail, clearEmail, getEmail } from 'leadforward/widget-react';

// After user logs in
setEmail('[email protected]');

// To clear the email (e.g., after logout)
clearEmail();

// To get the current email
const currentEmail = getEmail();

TypeScript Support

The email management functions are fully typed and provide excellent TypeScript support:

import { setEmail, clearEmail, getEmail } from 'leadforward/widget-react';

// All functions are properly typed
setEmail('[email protected]'); // (email: string) => void
clearEmail(); // () => void
const email: string = getEmail(); // () => string

Example: Integration with Authentication

Here's a complete example showing how to integrate the widget with user authentication:

import React, { useEffect, useState } from 'react';
import { LeadForwardWidget, setEmail, clearEmail } from 'leadforward/widget-react';

function App() {
  const [user, setUser] = useState(null);

  useEffect(() => {
    // When user logs in
    if (user?.email) {
      setEmail(user.email);
    } else {
      // When user logs out
      clearEmail();
    }
  }, [user]);

  return (
    <div>
      {/* Your app content */}
      
      <LeadForwardWidget 
        config={{
          projectId: 'your-project-id',
          // No initial email - will be set dynamically after login
          position: 'bottom-right',
          theme: 'auto',
          primaryColor: '#6366f1',
        }}
      />
    </div>
  );
}

Custom Labels

You can customize the text displayed on buttons:

<LeadForwardWidget 
  config={{
    projectId: 'your-project-id',
    email: '[email protected]',
    customLabels: {
      suggestFeature: 'Request Feature',
      reportBug: 'Report Issue',
      generalFeedback: 'Send Feedback',
      viewRoadmap: 'Product Roadmap'
    }
  }}
/>

Hiding Widget on Specific Paths

You can hide the widget on specific URL paths using the hideInPaths option:

<LeadForwardWidget 
  config={{
    projectId: 'your-project-id',
    email: '[email protected]',
    hideInPaths: [
      '/admin',           // Hide on exact path
      '/dashboard/*',     // Hide on all dashboard routes
      '/checkout',        // Hide on checkout page
      '/settings/*',      // Hide on all settings routes
      '/privacy-policy'   // Hide on privacy policy page
    ]
  }}
/>

The hideInPaths option supports:

  • Exact matching: /admin will only hide the widget on exactly /admin
  • Wildcard matching: /dashboard/* will hide the widget on /dashboard, /dashboard/users, /dashboard/settings, etc.
  • Dynamic updates: The widget automatically shows/hides when navigating between pages
  • SPA compatibility: Works with single-page applications that use history.pushState or history.replaceState

TypeScript

This package includes TypeScript definitions. The main types are:

import type { LeadForwardConfig } from 'leadforward/widget-react';

const config: LeadForwardConfig = {
  projectId: 'your-project-id',
  // email is optional - can be set later with setEmail()
  position: 'bottom-right',
  theme: 'auto',
  primaryColor: '#6366f1',
  hideInPaths: ['/admin', '/checkout/*']
};

// Or with email provided initially
const configWithEmail: LeadForwardConfig = {
  projectId: 'your-project-id',
  email: '[email protected]',
  position: 'bottom-right',
  theme: 'auto',
  primaryColor: '#6366f1',
  hideInPaths: []
};

License

MIT