@eshal-bot/chat-widget

中文文档
0.2.54发布于 2026/11/13MITTypeScriptESM + CJS近 30 天下载 7153

Beautiful, embeddable chat widget with dark mode support

原始使用文档
文档目录8 节
  1. Features
  2. Quick Start
  3. Installation
  4. Usage
  5. Configuration
  6. API Methods
  7. Development
  8. License

Eshal Chat Widget

A beautiful, production-ready chat widget with dark mode support, quick questions, and smooth animations.

Features

  • 🎨 Beautiful Design - Modern, professional UI inspired by Intercom
  • 🌓 Dark Mode - Full dark mode support with smooth transitions
  • ⚡ Quick Questions - Pre-defined clickable questions for users
  • 🤖 Bot Avatar - Customizable bot avatar for assistant messages
  • 📱 Responsive - Works perfectly on all devices
  • 🚀 Lightweight - Optimized bundle size and performance

Quick Start

Installation

npm install
npm run build

Usage

<!-- Include the widget -->
<link rel="stylesheet" href="dist/index.css">
<script src="dist/chat-widget.min.js"></script>

<script>
  ChatWidget.init({
    companyName: "Your Company",
    companyLogo: "https://example.com/logo.png",
    primaryColor: "#2563eb",
    quickQuestions: [
      "What are your business hours?",
      "How can I contact support?",
      "What services do you offer?"
    ],
    apiBaseUrl: "https://your-api.com",
    organizationId: "your-org-id"
  });
</script>

Configuration

OptionTypeDefaultDescription
companyNamestring"Support Team"Company/team name
companyLogostringnullCompany logo URL
primaryColorstring"#2563eb"Primary brand color
quickQuestionsstring[][]Array of quick questions
darkModebooleanfalseEnable dark mode
positionstring"bottom-right"Widget position
apiBaseUrlstringnullAPI endpoint URL
organizationIdstringnullOrganization ID

API Methods

// Open the widget
ChatWidget.open();

// Close the widget
ChatWidget.close();

// Toggle theme
ChatWidget.toggleTheme();

// Update configuration
ChatWidget.updateConfig({ primaryColor: "#ff0000" });

// Send message programmatically
ChatWidget.sendMessage("Hello!");

// Destroy the widget
ChatWidget.destroy();

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Generate TypeScript definitions
npm run generate-types

License

MIT

版本与发布记录

@eshal-bot/chat-widget 共发布 174 个版本,首次发布于 2025/11/10;过去 12 个月发布了 170 个版本。

版本发布日期距今
0.2.54latest2026/11/13今天
0.2.532026/11/131 天前
0.2.522026/11/121 天前
0.2.512026/11/121 天前
0.2.502026/11/121 天前
0.2.492026/11/112 天前

关于 @eshal-bot/chat-widget 的常见问题

@eshal-bot/chat-widget 是什么?

Beautiful, embeddable chat widget with dark mode support

如何安装 @eshal-bot/chat-widget?

在项目目录运行 npm install @eshal-bot/chat-widget,或使用 pnpm add / yarn add / bun add。

@eshal-bot/chat-widget 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eshal-bot/chat-widget 支持 ESM 还是 CommonJS?

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

@eshal-bot/chat-widget 可以商用吗?

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

@eshal-bot/chat-widget 的下载量有多少?

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

@eshal-bot/chat-widget 还在维护吗?

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