Skip to main content

LMChatAIButton

LMChatAIButton renders the button for LikeMinds AI-Chatbot. This is a standalone component and accepts the following set of props.

Props

PropertyTypeDescriptionOptional
buttonTextstringThe text displayed on the AI button.✔️
loadingScreenAnimatonsJSONThe animations used during loading.✔️
previewTextstringThe preview text shown before interaction.✔️
closeAIChatbot() => voidFunction to close the AI chatbot.✔️
showSettingUpChatbotTextbooleanWhether to show a chatbot setup message.✔️
isClearChatOptionEnabledbooleanWhether the clear chat option is enabled.

CSS Classnames

ClassnameDescription
lm-chat-ai-bot-fab-button closeContainer or element for lm chat ai bot fab button close
lm-chat-ai-bot-fab-titleContainer or element for lm chat ai bot fab title
lm-chat-ai-bot-fab-button openContainer or element for lm chat ai bot fab button open
lm-chat-ai-bot-fab-containerContainer or element for lm chat ai bot fab container

Example

To customise the component with their classnames, Open your base css file and override the styles using the classname

.lm-chat-ai-bot-fab-title {
font-size: 18px;
color: "red";
}

Advanced Customisation

Customising AI Chatbot Loader Screen

You can also pass your custom component to replace the default view for chatroom loader Screen. This will just be a static screen.

Below is an example for customising the view for chatroom loader and rendering your own view. It is fairly a 2 simple step process

  • First you create your own custom component. For this particular component you don't need to use any hook or context, since this is just a static screen

  • Then you just have to pass it as a prop to LMChatAIButton.

  • Step 1: Create your own custom view.

import {
LMChatAIButton,
LMChannel,
initiateLMClient,
LMChatTheme,
} from "@likeminds.community/likeminds-chat-reactjs";

// Custom Component for AiChatbotLoaderScreen
const CustomAiChatbotLoaderScreen = () => {
return (
// Your Custom Code
);
};
  • Step 2: Pass your Custom View to LMClientOverlayProvider
import {
LMChatAIButton,
LMChannel,
initiateLMClient,
LMChatTheme,
} from "@likeminds.community/likeminds-chat-reactjs";

const App = () => {
const lmChatClient = initiateLMClient();
return (
<LMChatAIButton
client={lmChatClient}
userDetails={userDetails}
lmChatTheme={LMChatTheme.NETWORKING_CHAT}
customComponents={{
aiChatbotLoaderScreen: <CustomAiChatbotLoaderScreen />,
}}
/>
);
};
export default App;

Reference

For reference checkout this file