miu.ai chat widget for React
react-miu-ai-widget
is a simple React component that injects the miu.ai chatbot into your web application. This allows you to enhance your customer support and engagement through AI-powered chat interactions.
Installation
First, you need to install the package via npm or yarn.
npm install react-miu-ai-widget
# or
yarn add react-miu-ai-widget
Usage
You can use the ChatWidget
component to embed the miu.ai chatbot into your React app. Pass your unique API key and optionally a color for the chat widget.
Example
import React from 'react';
import ChatWidget from 'react-miu-ai-widget';
const App = () => (
<div>
<h1>Welcome to My Website</h1>
<ChatWidget apiKey="your-api-key" color="#0ea079" dark={false} />
</div>
);
ReactDOM.render(<App />, document.getElementById('root'));
Props
apiKey
: The unique API key provided by miu.ai. This is a required prop.color
: The color code for customizing the chat widget. This is an optional prop.dark
: Use dark theme. This is an optional prop.
Cleanup
The component ensures that the script is removed from the DOM if the component unmounts, to avoid any potential memory leaks or unintended behavior.
License
MIT License
Support
If you have any questions or issues, feel free to contact our support team.