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

@inappai/react

v1.0.5

Published

Beautiful, customizable AI chat component for React applications

Readme

@inappai/react

npm version License: MIT

Beautiful, customizable AI chat component for React applications. Built by InAppAI.

Features

  • Beautiful UI - Polished interface out of the box
  • 🎨 7 Built-in Themes - Light, dark, professional, playful, minimal, ocean, sunset
  • 📱 Responsive Design - Works seamlessly on desktop and mobile
  • 🎯 Multiple Display Modes - Popup, sidebar, panel, or embedded
  • 🎛️ Controlled Mode - Full control over message state
  • 🔧 Tool Support - Function calling for AI agent interactions
  • Zero Config - Works with sensible defaults
  • 📦 Lightweight - Minimal bundle size (~60KB)
  • 🔷 TypeScript - Full type safety included
  • ⚛️ React 18 & 19 - Supports both React 18 and 19

Installation

npm install @inappai/react

Quick Start

import { useState } from 'react';
import { InAppAI, Message } from '@inappai/react';
import '@inappai/react/styles.css';

function App() {
  const [messages, setMessages] = useState<Message[]>([]);

  return (
    <InAppAI
      agentId="your-agent-id"
      messages={messages}
      onMessagesChange={setMessages}
    />
  );
}

Get your agent ID from inappai.com.

Display Modes

Popup Mode (Default)

Chat appears as a floating bubble in the corner:

<InAppAI
  agentId="your-agent-id"
  messages={messages}
  onMessagesChange={setMessages}
  displayMode="popup"
  position="bottom-right"
/>

Sidebar Mode

Chat slides in from the side:

<InAppAI
  agentId="your-agent-id"
  messages={messages}
  onMessagesChange={setMessages}
  displayMode="sidebar-right"
/>

Panel Mode

Resizable panel overlay:

<InAppAI
  agentId="your-agent-id"
  messages={messages}
  onMessagesChange={setMessages}
  displayMode="panel-right"
  panelDefaultWidth="400px"
/>

Embedded Mode

Embed chat directly in your layout:

<div style={{ height: '600px', width: '400px' }}>
  <InAppAI
    agentId="your-agent-id"
    messages={messages}
    onMessagesChange={setMessages}
    displayMode="embedded"
    showHeader={false}
  />
</div>

Themes

Choose from 7 built-in themes:

<InAppAI
  agentId="your-agent-id"
  messages={messages}
  onMessagesChange={setMessages}
  theme="dark" // light | dark | professional | playful | minimal | ocean | sunset
/>

Custom Styling

Override styles with custom CSS:

<InAppAI
  agentId="your-agent-id"
  messages={messages}
  onMessagesChange={setMessages}
  customStyles={{
    primaryColor: '#FF6B6B',
    headerTitle: 'Support Chat',
    buttonIcon: '💬',
  }}
/>

Tool Support

Register custom tools for AI function calling:

import { InAppAI, Tool } from '@inappai/react';

const tools: Tool[] = [
  {
    name: 'get_weather',
    description: 'Get current weather for a location',
    parameters: {
      type: 'object',
      properties: {
        location: { type: 'string', description: 'City name' },
      },
      required: ['location'],
    },
    handler: async ({ location }) => {
      const weather = await fetchWeather(location);
      return { temperature: weather.temp, condition: weather.condition };
    },
  },
];

function App() {
  const [messages, setMessages] = useState<Message[]>([]);

  return (
    <InAppAI
      agentId="your-agent-id"
      messages={messages}
      onMessagesChange={setMessages}
      tools={tools}
    />
  );
}

Context Passing

Send application context to make responses more relevant:

<InAppAI
  agentId="your-agent-id"
  messages={messages}
  onMessagesChange={setMessages}
  context={{
    page: 'dashboard',
    userId: user.id,
    userRole: user.role,
  }}
/>

Or use dynamic context:

<InAppAI
  agentId="your-agent-id"
  messages={messages}
  onMessagesChange={setMessages}
  context={() => ({
    currentUrl: window.location.pathname,
    selectedText: window.getSelection()?.toString(),
  })}
/>

API Reference

Required Props

| Prop | Type | Description | |------|------|-------------| | agentId | string | Your agent ID from InAppAI platform | | messages | Message[] | Array of conversation messages | | onMessagesChange | (messages: Message[]) => void | Callback when messages change |

Display Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | displayMode | 'popup' \| 'sidebar-left' \| 'sidebar-right' \| 'panel-left' \| 'panel-right' \| 'embedded' | 'popup' | Layout mode | | position | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | 'bottom-right' | Button position (popup only) | | defaultFolded | boolean | false | Start folded (sidebar/panel only) | | showHeader | boolean | true | Show/hide header |

Styling Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | theme | 'light' \| 'dark' \| 'professional' \| 'playful' \| 'minimal' \| 'ocean' \| 'sunset' | 'light' | Built-in theme | | customStyles | CustomStyles | {} | Custom style overrides |

Data Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | context | Record<string, any> \| (() => Record<string, any>) | - | App context sent with messages | | conversationId | string | Auto-generated | Conversation identifier | | authToken | string | - | JWT token for authentication | | tools | Tool[] | [] | Custom tools for function calling |

Panel Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | panelMinWidth | string | '20%' | Minimum panel width | | panelMaxWidth | string | '33.33%' | Maximum panel width | | panelDefaultWidth | string | '25%' | Initial panel width | | onPanelResize | (width: number) => void | - | Panel resize callback |

Event Hooks

| Prop | Type | Description | |------|------|-------------| | onMessageSent | (message: Message) => void | Called when user sends message | | onMessageReceived | (message: Message) => void | Called when AI responds | | onError | (error: Error) => void | Called on errors |

Types

interface Message {
  role: 'user' | 'assistant';
  content: string;
  timestamp?: number;
}

interface Tool {
  name: string;
  description: string;
  parameters: object;
  handler: (args: any) => Promise<any>;
}

interface CustomStyles {
  primaryColor?: string;
  headerTitle?: string;
  buttonIcon?: string;
  windowWidth?: string;
  // ... and many more
}

Resources

Requirements

  • React 18.0.0 or higher (supports React 19)
  • Modern browser with ES2020 support

Browser Support

  • Chrome/Edge (latest 2 versions)
  • Firefox (latest 2 versions)
  • Safari (latest 2 versions)
  • Mobile browsers (iOS Safari, Chrome Mobile)

Contributing

Contributions are welcome! Please see our GitHub repository for contribution guidelines.

Support

License

MIT © InAppAI


Built with ❤️ by the InAppAI team