Skip to main content

LMParticipantList

LMChatAllMembersScreen renders the participant list of the current chatroom. It accepts the following set of props.

Props

PropertyTypeDescriptionOptional
chatroomIdnumberThe ID of the chatroom.

CSS Classnames

ClassnameDescription
lm-participant-wrapperContainer or element for lm participant wrapper
lm-participant-headerContainer or element for lm participant header
headingContainer or element for heading
back-iconContainer or element for back icon
countsContainer or element for counts
member-searchContainer or element for member search
lm-participant-bodyContainer or element for lm participant body
lm-participant-cardContainer or element for lm participant card
lm-participant-card-userContainer or element for lm participant card user
lm-participant-card-detailContainer or element for lm participant card detail
nameContainer or element for name
descContainer or element for desc

Example

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

.lm-participant-header {
font-size: 18px;
color: "red";
}

Advanced Customisation

Hooks Used

Contexts Used

For changes that are not possible via CSS changes, you can also pass along you custom component for LMParticipantList. You can get the details of the chatroom participants by using the hook useParticipants. You can take a look at the reference file, to know all the hooks and contexts used.

Below is an example of how you can create your Custom View for LMHeader It's a simple 2 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 chatroom participants by using the hook useParticipants.

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

  • Step 1: Create your own custom view.

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

// Custom Component for ParticipantList
const CustomParticipantsScreen = ({
chatroomId
}) => {
const {
participantsList,
} = useParticipants(chatroomId);
return (
// Your Custom Code for rendering the participant list
);
};

  • Step 2: Pass your Custom View to LMClientOverlayProvider
import {
LMClientOverlayProvider,
LMChannel,
initiateLMClient,
LMChatTheme,
LMChatroomContext,
useParticipants
} from "@likeminds.community/likeminds-chat-reactjs";

// Custom Component for Participant List
const CustomParticipantsScreen = ({
chatroomId
}) => {
const {
participantsList,
} = useParticipants(chatroomId);
return (
// Your Custom Code for rendering the participant list
);
};

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

Reference

For reference checkout this file