Contacts
CometChatContacts is a versatile React UI component specifically designed to facilitate the display and management of users and groups within chat applications. It streamlines the process of showcasing all app users and available chat groups in a user-friendly interface, making it easier for users to connect and communicate effectively.
Key Features:
- User List View: CometChatContacts presents a comprehensive list of all registered users within the application. This list allows users to quickly find and select specific individuals they wish to interact with.
- Group List View: The component also offers a dedicated view to showcase all the available chat groups. This simplifies the process of joining or creating new group conversations.
- Smart Search Functionality: Users can utilize the powerful search feature to quickly locate specific users or groups by typing names or keywords. This ensures seamless navigation, even in applications with a large user base.
- Selection Mode: CometChatContacts supports a selection mode, enabling users to pick multiple contacts or groups simultaneously. This feature proves useful for creating group chats or forwarding messages to multiple recipients.
- Customizable Tab Layout: Developers can easily customize the appearance of the tabs, including text colors, indicator color, and background, to match the app's branding and aesthetics.
- Selection Limit Control: Developers have the flexibility to set a selection limit, restricting the number of contacts or groups a user can select during the selection mode. This helps maintain messaging policies and optimize user experience.
- User-Friendly Close Button: The component provides a convenient close button feature, allowing users to exit the Contacts view and return to their previous screen or chat interface effortlessly.
How to integrate CometChatContacts
- ContactsDemo.tsx
- App.tsx
import {
CometChatContacts,
} from "@cometchat/chat-uikit-react";
function ContactsDemo() {
return (
<CometChatContacts
title="CometChat Contacts"
/>
);
}
export default ContactsDemo;
import ContactsDemo from "./ContactsDemo";
export default function App() {
return (
<div className="App">
<ContactsDemo />
</div>
);
}
Properties
ContactsStyle
You can set the contactsStyle to the CometChatContacts Component to customize the styling.
List of properties exposed by ContactsStyle:
Name | Type | Description |
---|---|---|
width | string | Sets the width of the CometChatContacts component. |
height | string | Sets the height of the CometChatContacts component. |
border | string | Sets the border style of the CometChatContacts component. |
borderRadius | string | Sets the border radius of the CometChatContacts component. |
background | string | Sets the background color of the CometChatContacts component. |
titleTextFont | string | Sets the font for the title text of the CometChatContacts component. |
titleTextColor | string | Sets the text color for the title text of the CometChatContacts component. |
closeIconTint | string | Sets the tint color for the close icon of the CometChatContacts component. |
tabWidth | string | Sets the width of the tabs within the CometChatContacts component. |
tabHeight | string | Sets the height of the tabs within the CometChatContacts component. |
tabBorder | string | Sets the border color of the tabs within the CometChatContacts component. |
tabBorderRadius | string | Sets the border radius of the tabs within the CometChatContacts component. |
tabBackground | string | Sets the background color of the tabs within the CometChatContacts component. |
tabTitleTextFont | string | Sets the font for the title text of the tabs within the CometChatContacts component. |
tabTitleTextColor | string | Sets the text color for the title text of the tabs within the CometChatContacts component. |
activeTabTitleTextColor | string | Sets the text color for the active title text of the tabs within the CometChatContacts component. |
activeTabTitleTextFont | string | Sets the font for the active title text of the tabs within the CometChatContacts component. |
activeTabBackground | string | Sets the background color for the active tabs within the CometChatContacts component. |
activeTabBorder | string | Sets the border color for the active tabs within the CometChatContacts component. |
selectionIconTint | string | Sets the tint color for the selection icon within the CometChatContacts component. |
errorStateTextFont | string | Sets the font for displaying error messages within the CometChatContacts component. |
errorStateTextColor | string | Sets the text color for displaying error messages within the CometChatContacts component. |
boxShadow | string | Sets the shadow appearance for the CometChatContacts component. |
submitButtonBackground | string | Sets the background color of the submit button within the CometChatContacts component. |
submitButtonTextColor | string | Sets the text color of the submit button within the CometChatContacts component. |
submitButtonTextFont | string | Sets the font for the submit button text within the CometChatContacts component. |
padding | string | Sets the padding for the CometChatContacts component. |
- JavaScript/TypeScript
const contactsStyle = new ContactsStyle({
width: "100vw",
height: "100vh",
border: "1px solid #ccc",
borderRadius: "8px",
background: "#f0f0f0",
titleTextFont: "14px Arial, sans-serif",
titleTextColor: "#333",
closeIconTint: "blue",
});