@gauravrathod674/super-customizable-chatbot

中文文档
1.18.6发布于 2026/02/04MITESM + CJS零依赖近 30 天下载 2251

A highly customizable React chatbot component with support for Gemini, OpenAI, Anthropic, and Groq APIs.

原始使用文档
文档目录17 节
  1. 🎥 Demo Preview
  2. ✨ Features
  3. 📦 Installation
  4. AI Provider SDKs
  5. 🚀 Usage
  6. Example: Google Gemini
  7. Example: OpenAI
  8. Example: Anthropic (Claude)
  9. Example: Groq
  10. Example: Speech to text and File Upload
  11. 🧠 Custom Instructions (System Prompts)
  12. 🎨 Theming & Customization
  13. Example: Typing Animation & Custom Theme
  14. API Reference
  15. Component Props
  16. Theming Options ( theme object)
  17. License

Super Customizable React ChatBot

npm npm downloads License: MIT

A highly customizable, performant, and intelligent React chatbot component. Drop it into any project to add a powerful conversational AI interface, powered by Google Gemini, OpenAI, Anthropic (Claude), and Groq.

🎥 Demo Preview

Here’s how beautiful and functional this chatbot can look in your React app:

Watch the Demo on YouTube

🔗 Watch the full video on YouTube

This demo showcases:

  • Seamless integration in React
  • Clean modal and widget views
  • Typing animation with customizable themes
  • Usage with OpenAI/Gemini/Claude/Groq APIs

✨ Features

  • 🤖 Multi-API Support: Integrates directly with Google Gemini, OpenAI, Anthropic (Claude), and Groq.
  • 🧠 Custom Instructions: Provide a system prompt to define the bot's persona, role, and rules.
  • 🚀 Model Selection: Choose the exact AI model you want to use from any supported provider (e.g., gemini-1.5-flash, gpt-4o-mini, claude-3-haiku, llama3-8b-8192).
  • 🎨 Deeply Customizable: Use a comprehensive theme object to control every color, font, border, and size.
  • 🎬 Typing Animation: Engage users with a smooth, character-by-character typing animation for bot responses.
  • 🗣️ Speech-to-Text (optional) — Built-in voice input using the browser's Web Speech API for hands-free interaction.
  • 📎 File Uploads (optional): Allow users to upload images and files for multi-modal conversations with compatible models (Gemini, GPT-4o, Claude 3).
  • 🧩 Flexible Placement: Display as a classic corner widget or a large, focused modal.
  • 💅 Markdown Rendering: Automatically renders lists, bold/italic text, headers, and more.
  • 💪 Controlled & Uncontrolled Modes: Use it as a simple plug-and-play component or take full control over its state.
  • ♿ Accessible: Designed with accessibility in mind, including focus management and ARIA attributes.

📦 Installation

Install the package and its core peer dependencies from NPM.

npm install @gauravrathod674/super-customizable-chatbot @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons @fortawesome/fontawesome-svg-core framer-motion react-markdown

AI Provider SDKs

You also need to install the SDK for the specific AI provider you want to use. You only need to install the ones you plan to use.

# For Google Gemini
npm install @google/generative-ai

# For OpenAI
npm install openai

# For Anthropic (Claude)
npm install @anthropic-ai/sdk

# For Groq
npm install groq-sdk

🚀 Usage

Import the component and its stylesheet, then render it with the appropriate API key.

Example: Google Gemini

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const GEMINI_API_KEY = "YOUR_GEMINI_API_KEY";

  return (
    <ChatBot
      botName="Gemini Bot"
      geminiApiKey={GEMINI_API_KEY}
      geminiModelName="gemini-1.5-flash"
      welcomeMessage="I am powered by Gemini. How can I help?"
    />
  );
}

Example: OpenAI

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const OPENAI_API_KEY = "YOUR_OPENAI_API_KEY";

  return (
    <ChatBot
      botName="OpenAI Bot"
      openaiApiKey={OPENAI_API_KEY}
      openaiModelName="gpt-4o-mini"
      welcomeMessage="I am powered by OpenAI. How can I help?"
    />
  );
}

Example: Anthropic (Claude)

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const ANTHROPIC_API_KEY = "YOUR_ANTHROPIC_API_KEY";

  return (
    <ChatBot
      botName="Claude Bot"
      anthropicApiKey={ANTHROPIC_API_KEY}
      anthropicModelName="claude-3-haiku-20240307"
      welcomeMessage="I am powered by Claude. How can I help?"
    />
  );
}

Example: Groq

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const GROQ_API_KEY = "YOUR_GROQ_API_KEY";

  return (
    <ChatBot
      botName="Groq Bot"
      grokApiKey={GROQ_API_KEY}
      grokModelName="llama3-8b-8192"
      welcomeMessage="I am powered by Groq. I am very fast. How can I help?"
    />
  );
}

Example: Speech to text and File Upload

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const GEMINI_API_KEY = "YOUR_GEMINI_API_KEY";

  return (
    <ChatBot
      botName="Gemini Bot"
      geminiApiKey={GEMINI_API_KEY}
      geminiModelName="gemini-1.5-flash"
      enableMicrophone="enabled"
      enableFileUpload={true}
      fileUploadAccept="image/*,.pdf,.doc,.docx" 
      welcomeMessage="I am powered by Gemini. How can I help?"
    />
  );
}

🧠 Custom Instructions (System Prompts)

Define a persona or set of rules for the AI using the customInstruction prop. The chatbot will adhere to this instruction throughout the conversation.

<ChatBot
  botName="Pirate Bot"
  openaiApiKey="YOUR_OPENAI_API_KEY"
  customInstruction="You are a helpful assistant who speaks like a pirate. Keep your answers brief and witty."
  welcomeMessage="Ahoy there, matey! What be yer question?"
/>

🎨 Theming & Customization

The component's biggest strength is its customizability. You can override any default style by passing a theme object.

Example: Typing Animation & Custom Theme

This example creates a large, centered chatbot with a blurred backdrop, a unique color scheme, and the new typing animation.

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function ChatPage() {
  const corporateTheme = {
    header: { backgroundColor: '#1e3a8a' },
    messages: {
      userBackgroundColor: '#2563eb',
      botBackgroundColor: '#eef2ff',
      botTextColor: '#1e3a8a',
      animation: 'typing', // <-- Enable the typing animation
    },
    window: {
      placement: 'center',
      backdrop: true,
      backdropBlur: '3px',
    },
    input: { focusRingColor: '#2563eb' },
    launcher: { backgroundColor: '#1e3a8a' },
  };

  return (
    <ChatBot
      botName="CorpBot"
      openaiApiKey="YOUR_OPENAI_API_KEY"
      theme={corporateTheme}
    />
  );
}

API Reference

The component can be customized through two main avenues: direct props for behavior and a theme object for appearance.

Component Props

These props control the chatbot's functionality, identity, and AI integration.

PropTypeDefaultDescription
geminiApiKeystringundefinedYour Google Gemini API key.
openaiApiKeystringundefinedYour OpenAI API key.
anthropicApiKeystringundefinedYour Anthropic (Claude) API key.
grokApiKeystringundefinedYour Groq API key.
geminiModelNamestring'gemini-1.5-flash'The Gemini model to use.
openaiModelNamestring'gpt-4o-mini'The OpenAI model to use.
anthropicModelNamestring'claude-3-haiku-20240307'The Anthropic model to use.
grokModelNamestring'llama3-8b-8192'The Groq model to use.
customInstructionstring''A system prompt to define the bot's persona or behavior.
enableMicrophonestringundefinedAny truthy string to enable the Speech-to-Text microphone. Does not require actual credentials.
enableFileUploadbooleanfalseEnables the file attachment button.
fileUploadAcceptstring*A string of accepted file types for the upload dialog (e.g., "image/*, .pdf").
onFileUpload(file: File) => void() => {}**Callback that fires when a user selects a file.
botNamestring'ChatBot'The name displayed in the header.
welcomeMessagestring'Hello! How can I help?'The initial message displayed by the bot.
placeholderTextstring'Type a message...'The placeholder text in the input field.
botAvatarReact.ReactNode<DefaultBotIcon />An icon or image URL for the bot's avatar.
userAvatarReact.ReactNode<DefaultUserIcon />An icon or image URL for the user's avatar.
isOpenbooleanfalseControls whether the chat window is open initially.
disabledbooleanfalseDisables the input field and send button.
onSend(message: string) => void() => {}Callback when a user sends a message.
themeobject{}A theme object to customize the UI. See table below.
messagesArray<{id, text, sender}>undefinedAdvanced: A controlled array of message objects.
isTypingbooleanfalseAdvanced: Manually controls the bot's typing indicator.

Theming Options (theme object)

Pass a theme object to customize the chatbot's appearance. Any property you don't provide will fall back to its default value.

Launcher Button

PathTypeDefaultDescription
launcher.backgroundColorstring'#4f46e5'Background color of the launcher button.
launcher.iconColorstring'#ffffff'Color of the icon inside the launcher.
launcher.sizestring'3.5rem'The width and height of the launcher button.

Chat Window

PathTypeDefaultDescription
window.placementstring'bottom-right'Position on screen. Options: 'bottom-right', 'bottom-left', 'center'.
window.widthstring'22rem'Width of the chat window. (Defaults to '80vw' if placement is 'center').
window.heightstring'30rem'Height of the chat window. (Defaults to '80vh' if placement is 'center').
window.backgroundColorstring'#ffffff'Background color of the main chat window.
window.borderColorstring'#e5e7eb'Border color of the main chat window.
window.borderRadiusstring'0.75rem'Border radius of the main chat window.
window.backdropbooleanfalseShow blurred backdrop (only for 'center' placement).
window.backdropColorstring'rgba(0,0,0,0.4)'Color of the backdrop overlay.
window.backdropBlurstring'4px'CSS blur value for the backdrop.
window.scrollbarThumbColorstring'#a1a1aa'Color of the message list's scrollbar thumb.
window.scrollbarTrackColorstring'#f1f5f9'Color of the message list's scrollbar track.

Header

PathTypeDefaultDescription
header.backgroundColorstring'#4f46e5'Background color of the header.
header.textColorstring'#ffffff'Text color for the bot's name in the header.
header.fontFamilystring'inherit'Font family for the header text.
header.fontWeightstring'600'Font weight for the header text.

Messages

PathTypeDefaultDescription
messages.userBackgroundColorstring'#4f46e5'Background color for user message bubbles.
messages.userTextColorstring'#ffffff'Text color for user messages.
messages.botBackgroundColorstring'#f3f4f6'Background color for bot message bubbles.
messages.botTextColorstring'#1f2937'Text color for bot messages.
messages.fontFamilystring'inherit'Font family for all message text.
messages.fontSizestring'0.9rem'Font size for all message text.
messages.showAvatarsbooleantrueWhether to display avatars next to messages.
messages.bubbleShapestring'rounded'Shape of bubbles. Options: 'rounded', 'square'.
messages.bubblePointerbooleantrueShow a small pointer on the message bubbles.
messages.animationstring'fade-in'Bot response animation. Options: 'fade-in', 'typing', 'slide-up', 'zoom-in', 'flip', 'none'.

Markdown Customization (messages.markdownStyles)

PathTypeDefaultDescription
markdownStyles.boldColorstringinheritColor for **bold** text.
markdownStyles.italicColorstringinheritColor for *italic* text.
markdownStyles.linkColorstring'#3b82f6'Color for [links](...).
markdownStyles.codeColorstringinheritText color for inline code.
markdownStyles.codeBackgroundColorstringrgba(0,0,0,0.1)Background color for inline code.

Input Area

PathTypeDefaultDescription
input.backgroundColorstring'#ffffff'Background color for the input footer area.
input.textColorstring'#1f2937'Text color for the user's typed input.
input.placeholderTextColorstring'#9ca3af'Color of the placeholder text.
input.borderColorstring'#e5e7eb'Border color for the text input field.
input.focusRingColorstring'#4f46e5'Color of the focus ring when the input is selected.

License

This project is licensed under the MIT License.

版本与发布记录

@gauravrathod674/super-customizable-chatbot 共发布 551 个版本,首次发布于 2025/07/26;过去 12 个月发布了 238 个版本。

版本发布日期距今
1.18.6latest2026/02/049 个月前
1.18.52026/02/039 个月前
1.18.42026/02/039 个月前
1.18.32026/02/039 个月前
1.18.22026/02/029 个月前
1.18.12026/02/029 个月前

关于 @gauravrathod674/super-customizable-chatbot 的常见问题

@gauravrathod674/super-customizable-chatbot 是什么?

A highly customizable React chatbot component with support for Gemini, OpenAI, Anthropic, and Groq APIs.

如何安装 @gauravrathod674/super-customizable-chatbot?

在项目目录运行 npm install @gauravrathod674/super-customizable-chatbot,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@fortawesome/fontawesome-svg-core(>=6.0.0)、@fortawesome/free-solid-svg-icons(>=6.0.0)、@fortawesome/react-fontawesome(>=0.2.0)、framer-motion(>=11.0.0)、react(>=18.2.0)、react-dom(>=18.2.0)、react-markdown(>=9.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gauravrathod674/super-customizable-chatbot 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gauravrathod674__super-customizable-chatbot 是否存在。

@gauravrathod674/super-customizable-chatbot 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@gauravrathod674/super-customizable-chatbot 可以商用吗?

@gauravrathod674/super-customizable-chatbot 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gauravrathod674/super-customizable-chatbot 的下载量有多少?

根据 npm 官方下载统计,@gauravrathod674/super-customizable-chatbot 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,251 次,日均约 75 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gauravrathod674/super-customizable-chatbot 还在维护吗?

最新版本 1.18.6 发布于 2026/02/04(9 个月前);至今共发布 551 个版本,其中过去 12 个月发布了 238 个;首次发布于 2025/07/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。