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

@ihoomanai/react-chat

v3.0.12

Published

React components and hooks for Ihooman Chat Widget - secure Widget ID based initialization

Readme

@ihoomanai/react-chat

React components and hooks for the Ihooman Chat Widget. Provides native React integration with proper lifecycle management and SSR compatibility.

Installation

npm install @ihoomanai/react-chat
# or
yarn add @ihoomanai/react-chat
# or
pnpm add @ihoomanai/react-chat

Requirements

Quick Start

Basic Usage

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

function App() {
  return (
    <ChatWidget
      widgetId="wgt_abc123def456"
      position="bottom-right"
      onReady={() => console.log('Widget ready!')}
    />
  );
}

With Provider and Hook

For programmatic control over the widget from any component:

import { ChatWidgetProvider, ChatWidget, useChatWidget } from '@ihoomanai/react-chat';

function SupportButton() {
  const { open, isReady } = useChatWidget();
  
  return (
    <button onClick={open} disabled={!isReady}>
      Need Help?
    </button>
  );
}

function App() {
  return (
    <ChatWidgetProvider>
      <ChatWidget widgetId="wgt_abc123def456" />
      <SupportButton />
    </ChatWidgetProvider>
  );
}

Components

<ChatWidget />

The main component that renders the chat widget.

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | widgetId | string | Yes | Your Widget ID from the Ihooman dashboard | | serverUrl | string | No | Custom server URL (defaults to production) | | theme | 'light' \| 'dark' | No | Color theme | | position | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | No | Widget position | | startOpen | boolean | No | Start with widget open | | user | { name?: string; email?: string; metadata?: Record<string, string> } | No | User information | | onReady | () => void | No | Called when widget is ready | | onOpen | () => void | No | Called when widget opens | | onClose | () => void | No | Called when widget closes | | onMessage | (message: Message) => void | No | Called on new messages | | onError | (error: Error) => void | No | Called on errors |

<ChatWidgetProvider />

Context provider for global widget access. Wrap your app with this to use the useChatWidget hook.

<ChatWidgetProvider>
  {/* Your app components */}
</ChatWidgetProvider>

Hooks

useChatWidget()

Hook for controlling the widget from any component within the provider.

const {
  isOpen,      // boolean - Whether widget is open
  isReady,     // boolean - Whether widget is initialized
  isConnected, // boolean - Whether connected to server
  open,        // () => void - Open the widget
  close,       // () => void - Close the widget
  toggle,      // () => void - Toggle open/closed
  sendMessage, // (content: string) => void - Send a message
  setUser,     // (user: UserInfo) => void - Set user info
  clearHistory,// () => void - Clear chat history
  messages,    // Message[] - Current messages
  unreadCount, // number - Unread message count
} = useChatWidget();

Examples

With User Information

<ChatWidget
  widgetId="wgt_abc123def456"
  user={{
    name: 'John Doe',
    email: '[email protected]',
    metadata: {
      plan: 'premium',
      customerId: 'cust_123'
    }
  }}
/>

Custom Styling

<ChatWidget
  widgetId="wgt_abc123def456"
  primaryColor="#6366f1"
  gradientFrom="#6366f1"
  gradientTo="#8b5cf6"
  borderRadius={16}
  fontFamily="Inter, sans-serif"
/>

Programmatic Messages

function QuickActions() {
  const { sendMessage, isReady } = useChatWidget();

  return (
    <div>
      <button 
        onClick={() => sendMessage('I need help with my order')}
        disabled={!isReady}
      >
        Order Help
      </button>
      <button 
        onClick={() => sendMessage('How do I reset my password?')}
        disabled={!isReady}
      >
        Password Help
      </button>
    </div>
  );
}

Next.js / SSR

The component is SSR-compatible and defers initialization to the client:

// app/layout.tsx (App Router)
import { ChatWidgetProvider, ChatWidget } from '@ihoomanai/react-chat';

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        <ChatWidgetProvider>
          {children}
          <ChatWidget widgetId="wgt_abc123def456" />
        </ChatWidgetProvider>
      </body>
    </html>
  );
}
// pages/_app.tsx (Pages Router)
import { ChatWidgetProvider, ChatWidget } from '@ihoomanai/react-chat';

export default function App({ Component, pageProps }) {
  return (
    <ChatWidgetProvider>
      <Component {...pageProps} />
      <ChatWidget widgetId="wgt_abc123def456" />
    </ChatWidgetProvider>
  );
}

TypeScript

Full TypeScript support is included. Import types as needed:

import type { 
  ChatWidgetProps, 
  UseChatWidgetReturn,
  Message,
  UserInfo 
} from '@ihoomanai/react-chat';

Framework Compatibility

  • ✅ React 17+
  • ✅ React 18+
  • ✅ Next.js (Pages & App Router)
  • ✅ Gatsby
  • ✅ Remix
  • ✅ Vite
  • ✅ Create React App

License

MIT © Ihooman AI