A React-based chat widget that can be embedded in any website using a simple script tag. The widget is built with React and Tailwind CSS, and is bundled with Vite.
client/: Demo client page that loads the chat widgetserver/: Server that hosts the chat widget and its integration scriptsrc/: Source code for the React chat widgetcomponents/: React componentsindex.tsx: Main entry point for the widgetindex.css: Tailwind CSS imports
cd server
npm install
npm run devcd client
npm install
npm run devcd server
npm run buildThis will generate a UMD bundle in the dist/ directory that can be loaded in any website.
To integrate the chat widget in your website, add the following script tag:
<script src="http://localhost:9000/integration"></script>And add a container element with the ID "testdiv":
<div id="testdiv"></div>The script will create a shadow DOM inside this element and mount the React chat widget in it.
- React
- Tailwind CSS
- TypeScript
- Vite
- Bun