@varanjith1/chatbot-widget
v1.0.3
Published
A plug-and-play AI chatbot widget for any web application
Maintainers
Readme
Standalone AI Chatbot Widget
A framework-agnostic, "plug-and-play" chatbot widget built with Angular Elements. This widget compiles into a single JavaScript file that can be easily dropped into any web application (Angular, React, Vue, or plain HTML) to provide instant AI chat capabilities.
Features
- Plug & Play: Single JavaScript file (
chat-widget.js) contains all logic, styles, and assets. - Zero Setup (Angular): Installs with a single command
ng add @varanjith1/chatbot-widgetand auto-injects itself. - Auto-Injection: Automatically attaches itself to the
<body>upon loading. - Style Isolation: Uses Shadow DOM to prevent style conflicts with the host application.
- Zero Dependencies: No external CSS or libraries required in the host app.
Installation
Angular Projects (Recommended)
Run the following command in your Angular project:
ng add @varanjith1/chatbot-widgetThat's it! The widget will automatically appear in your application. No manual HTML or TypeScript changes are required.
Other Projects (React, Vue, HTML)
- Build the widget or download the
chat-widget.jsfile. - Include the script tag at the end of your
<body>.
<!DOCTYPE html>
<html lang="en">
<body>
<!-- Your website content -->
<!-- Chatbot Widget -->
<script src="path/to/chat-widget.js"></script>
</body>
</html>Development
Prerequisites
- Node.js (v18+)
- npm
Setup
- Clone the repository.
- Install dependencies:
npm install
Run Locally
To run the Angular project in development mode:
npm startBuild
To generate the standalone chat-widget.js file:
npm run build && node scripts/build-elements.jsThe output file will be located at dist/widget/chat-widget.js.
Customization
The widget renders as <ai-chatbot-widget>. You can target it with CSS/JS if strictly necessary, but it is designed to be self-contained.
To modify the internal styles or behavior, you must edit the source code in src/app/chat-widget/chat-widget.component.ts and rebuild.
