@ruchiralk/chat-bot-com
Version:
A customizable chatbot UI component for React
96 lines (63 loc) • 1.96 kB
Markdown
A fully customizable, lightweight and interactive chatbot UI component for React applications. Easily integrate a chatbot into your website with dynamic responses, custom styling and mobile responsiveness.
1.Installing
```bash
npm i @ruchiralk/chat-bot-com
```
2.Import library in your React project (📂src/App.jsx)
```bash
import React from 'react';
import Chatbot from '@ruchiralk/chat-bot-com';
import customResponses from './responses';
function App() {
return (
<div className="App">
<Chatbot customResponses={customResponses} />
</div>
);
}
export default App;
```
3.Customize your own chatbot responses,
Create a responses.js file in your project (📂src/responses.js)
```bash
const customResponses = {
greeting: "How can I help you today!",
responses: {
"products": "We offer electronics and cloths.",
"sale": "Check our homepage for current sales!",
"price": (input) => {
if (input.includes("expensive")) {
return "We offer competitive pricing!";
}
return "Prices vary by product.";
}
},
defaultResponse: "I can't respond that."
};
export default customResponses;
```
The chatbot comes with default CSS, but you can override styles
```bash
/* In your global CSS file */
/* Bot bubbles */
.botText span {
background:
}
/* User bubbles */
.userText span {
background:
}
/* Chatbot header */
.collapsible {
background:
}
```
https://chatbot-demo-live.vercel.app/
[](https://www.ruchiralk.me/)
[](https://www.linkedin.com/in/ruchira-kaluarachchi/)