Skip to main content

LMMessage

LMMessage renders the message UI. It internally segregates the UI depending of the conversation state.

CSS Classnames

ClassnameDescription
undo-dm-blocked lm-cursor-pointerUndo DM blocked cursor pointer element
lm-chat-cardChat card container
data-pillData pill element
lmUserDataUser data container
nameName element
lm-delete-msgDelete message button
timeTime element
lm-chat-message-reactions-holder-plateMessage reactions container
lm-mediaMedia container
lm-og-tagsOpen graph tags container
lm-og-imgOpen graph image element
lm-og-contentOpen graph content container
lm-og-titleOpen graph title element
lm-og-descOpen graph description element
lm-reply-wrapperReply wrapper container
lm-reply-wrapper-contentReply content container
lm-reply-wrapper-content-nameReply sender name element
lm-reply-wrapper-content-msgReply message content element
msgMessage text element
error-messageError message element
edited-bulletEdited indicator element
actionsMessage actions container
lm-cursor-pointerCursor pointer element
lm-add-emojiAdd emoji button
lm-date-dataDate data element
conversation senderConversation sender element
dmReqBlockDM request block element
dmActionsDM actions container

Example

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

.msg {
font-size: 18px;
color: "red";
}

Advance Customisations

Hooks Used

Contexts Used

You can customise different component for different types of conversation, infact you can provide your own customisation of each of the conversation types. Internally we use contexts such as LMMessageContext, UserProviderContext and many to get the message and other vitals informations which you might need to display the information. You can take a look at the reference file below to know more. Also you can checkout the Hooks and Contexts sections to know the information returned by them.

Customising LMMessage is a fair 2 simple step process.

  • First you create your own custom component using the hooks and contexts made available by LikeMinds. The will be responsible for fetching data, you might want to process. For example you can get the conversation details using the context LMMessageContext. Here you will get the conversation object which you will need to create your view.

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

Here is a sample custom component implementation

Customising LMMessage

With this customisation you will be taking direct control over all the different conversation object rendered by the SDK. You will be responsible for rendering the views for all the conversation state. This might be usefull if you want to limit your views or would want to customise many different types of conversation in a single go.

  • Step 1: First create your own custom LMMessageComponent.
// Custom Component for LMMessage

const CustomLMMessage = () => {

// Getting the message object
const { message } = useContext(LMMessageContext);
// Getting the current user object
const { currentUser } = useContext(UserProviderContext);

return (
// Your Custom View. You can use the information fethed from above to render your views
);
};
  • Step 2: Pass your Custom View to LMClientOverlayProvider
Customising LMMessage component
import {
LMClientOverlayProvider,
LMChannel,
initiateLMClient,
LMChatTheme,
} from "@likeminds.community/likeminds-chat-reactjs";

// Custom Component for LMMessage
const CustomLMMessage = () => {

// Getting the message object
const { message } = useContext(LMMessageContext);
// Getting the current user object
const { currentUser } = useContext(UserProviderContext);

return (
// Your Custom View. You can use the information fethed from above to render your views
);
};

const App = () => {
const lmChatClient = initiateLMClient();
return (
<LMClientOverlayProvider
client={lmChatClient}
userDetails={userDetails}
lmChatTheme={LMChatTheme.COMMUNITY_CHAT}
customComponents={{
groupChatChannelList: <CustomLMMessage />,
}}
>
<LMChannel />
</LMClientOverlayProvider>
);
};
export default App;

You can also provide custom component for other different conversation types. Check out the full list of customisations available from here. Use different props available under messageBubbles to customise that particular conversation view.

Reference

For reference checkout this file