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 🙏

© 2025 – Pkg Stats / Ryan Hefner

summarizewith-react

v0.1.9

Published

A lightweight, embeddable React widget for summarizing web content with AI (ChatGPT, Claude, Perplexity, Gemini, Grok).

Readme

Summarize With (React)

A lightweight, zero-dependency widget to summarize web pages with AI services like ChatGPT, Claude, Perplexity, Gemini, and Grok.

SummarizeWith Widget

Features

  • Zero External Dependencies: Lightweight and efficient.
  • Default Theme (Glass): Beautiful, adaptive frosted glass design out of the box.
  • Multiple Themes: Built-in support for Light, Dark, Minimal, and Glass themes.
  • React: Built specifically for Next.js and React applications.
  • Smart Context: Automatically prioritizes selected text, falling back to page content or URL.
  • Customizable: Configure services, layouts, prompt prefixes, and compact modes.

Installation

Method 1: CDN / Script Tag (Easiest)

Simply drop this script into your HTML. The widget will automatically register as <summarize-with-ai>.

<script src="https://unpkg.com/summarizewith-react@latest/dist/summarize-widget.iife.global.js"></script>

<!-- Render the widget -->
<summarize-with-ai></summarize-with-ai>

Method 2: NPM (React App)

npm install summarizewith-react
# or
yarn add summarizewith-react

Usage (React)

Import the widget and drop it into your React application.

import { SummarizeWidget } from 'summarizewith-react';
import 'summarizewith-react/dist/index.css';

export default function Page() {
  return (
    <main>
      <article>
        <h1>My Article</h1>
        <p>Your content here...</p>
      </article>

      {/* Render the widget */}
      <SummarizeWidget />
    </main>
  );
}

Props

The <SummarizeWidget /> component accepts the following props:

| Prop | Type | Default | Description | |------|------|---------|-------------| | services | ServiceId[] | ['chatgpt', 'claude', 'perplexity', 'gemini', 'grok'] | Array of service IDs to display. | | theme | 'default' \| 'light' \| 'dark' \| 'minimal' \| 'glass' | 'default' | Visual style of the widget. 'default' is the new glass/liquid theme. | | layout | 'auto' \| 'horizontal' \| 'vertical' | 'auto' | Controls the layout orientation. | | mode | 'url' \| 'content' | 'url' | 'url' sends the page URL. 'content' extracts page text. | | compact | boolean | false | If true, shows only icons without text labels. | | preferSelection | boolean | true | If true, processes user-selected text if available. | | maxChars | number | 4000 | Max characters to send in content mode. | | promptPrefix | string | undefined | Custom text to prepend to the user's prompt. | | geminiStyle | 'app' \| 'search' | 'search' | 'app' opens gemini.google.com. 'search' uses Google Search AI. | | extractContent | () => string | undefined | Custom function to extract content from the page. | | onClickService | (id, ctx) => void | undefined | Callback fired when a service is clicked. | | className | string | undefined | Additional CSS classes for the container. |

Examples

Compact Mode (Icons Only)

Perfect for sidebars or toolbars.

<SummarizeWidget compact={true} />

Vertical Layout

Force a vertical stack of buttons.

<SummarizeWidget layout="vertical" />

Custom Services

Show only specific AI services.

<SummarizeWidget services={['chatgpt', 'claude', 'perplexity']} />

Content Mode with Selection

Send the actual page content (or selection) instead of just the URL.

<SummarizeWidget 
  mode="content" 
  preferSelection={true} 
  maxChars={4000} 
/>

Custom Prompt

Prepend a custom instruction to the prompt sent to the AI.

<SummarizeWidget 
  promptPrefix="As a senior engineer, please summarize the key technical points:" 
/>

Analytics Callback

Track which services your users are choosing.

<SummarizeWidget 
  onClickService={(serviceId, context) => {
    analytics.track('summarize_click', { 
      service: serviceId, 
      mode: context.mode, 
      usedSelection: context.usedSelection 
    });
  }} 
/>

Theming & Customization

The widget uses CSS variables for easy customization. You can override these in your CSS to match your brand colors.

Icon Colors (Unified Theme System)

Version 0.1.7+ introduces a unified icon system where every service icon is controlled by CSS variables. This ensures perfect brand fidelity while allowing for complete customization.

:root {
  /* Override brand colors */
  --sw-icon-claude: #d97757;
  --sw-icon-perplexity: #20808d;
  --sw-icon-chatgpt: currentColor;
  
  /* Grok (Foreground/Background) */
  --sw-icon-grok-bg: #000000;
  --sw-icon-grok-fg: #ffffff;

  /* Gemini Gradient Stops */
  --sw-icon-gemini-1: #9168C0;
  --sw-icon-gemini-2: #5684D1;
  --sw-icon-gemini-3: #1BA1E3;
}

/* Dark Mode Overrides */
.dark {
  --sw-icon-perplexity: #1fb8cd; /* Lighter teal for dark backgrounds */
}

AI Integration Prompt

Want to verify this widget works? Copy this prompt into your AI coding assistant (Cursor, Copilot, etc.) to see it in action:

Integrate the 'SummarizeWith' widget (npm: summarizewith-react) into the current page.
Place it in a prominent position, preferably as a floating element or near the page title.
Use the 'default' theme. Ensure it handles both URL and content summarization.

License

MIT © Raz Syed