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

@cundi/react-chat-widget

v1.0.1

Published

A flexible React chat widget supporting callback and webhook modes

Readme

@cundi/react-chat-widget

A flexible React chat widget with support for both callback and webhook modes.

Features

  • 🎨 Ant Design inspired styling with light/dark themes
  • 📝 Markdown rendering with GFM support
  • 📊 Mermaid diagrams support
  • 📋 Code blocks with copy button
  • 📎 File upload/download support
  • 🖼️ Image paste (Ctrl+V)
  • 👤 Customizable avatars and names
  • 🔌 Two modes: Callback (custom handling) or Webhook (n8n, etc.)

Installation

npm install @cundi/react-chat-widget
# or
pnpm add @cundi/react-chat-widget

Usage

Callback Mode (Custom Message Handling)

Use this mode when you want to handle messages with your own logic (e.g., calling AI APIs).

import { ChatWidget } from '@cundi/react-chat-widget';

function App() {
  const handleMessage = async (message: string) => {
    // Call your AI API or process the message
    const response = await myAI.chat(message);
    return { output: response };
  };

  return (
    <ChatWidget
      onSendMessage={handleMessage}
      user={{ name: 'User', avatar: '👤' }}
      assistant={{ name: 'AI', avatar: '🤖' }}
    />
  );
}

Webhook Mode (n8n, External Services)

Use this mode to connect to external webhook endpoints like n8n Chat Triggers.

import { ChatWidget } from '@cundi/react-chat-widget';

function App() {
  return (
    <ChatWidget
      webhookUrl="https://your-n8n.com/webhook/chat-trigger-id"
      sessionId="unique-session-id"
      user={{ name: 'User', avatar: '👤' }}
      assistant={{ name: 'n8n Bot', avatar: '🤖' }}
    />
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | onSendMessage | (message: string, files?: File[]) => Promise<ChatResponse \| string> | - | Callback for handling messages | | webhookUrl | string | - | Webhook URL for external services | | sessionId | string | - | Session ID for conversation memory | | theme | 'light' \| 'dark' | 'light' | Theme mode | | title | string | 'Chat' | Chat header title | | placeholder | string | 'Type a message...' | Input placeholder | | allowFileUpload | boolean | false | Enable file upload | | maxFileSize | number | 10485760 | Max file size (bytes) | | showHeader | boolean | true | Show chat header | | user | AvatarConfig | - | User avatar and name | | assistant | AvatarConfig | - | Assistant avatar and name | | onMessage | (message: Message) => void | - | Callback when message received | | onError | (error: Error) => void | - | Callback on error |

Response Format

When using onSendMessage, return a ChatResponse object:

interface ChatResponse {
  output: string;        // Required: text content
  image?: string;        // Optional: single image URL
  images?: string[];     // Optional: multiple image URLs
  files?: Array<{        // Optional: file attachments
    name: string;
    url: string;
    type: string;
    size?: number;
  }>;
}

License

MIT