Skip to main content
Version: v4

Message Composer

Overview

MessageComposer is a Component that enables users to write and send a variety of messages, including text, image, video, and custom messages.

Features such as Live Reaction, Attachments, and Message Editing are also supported by it.

Image

MessageComposer is comprised of the following Base Components:

Base ComponentsDescription
MessageInputThis provides a basic layout for the contents of this component, such as the TextField and buttons
ActionSheetThe ActionSheet component presents a list of options in either a list or grid mode, depending on the user's preference

Usage

Integration

The following code snippet illustrates how you can directly incorporate the MessageComposer component into your app.

import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CometChatMessageComposer } from '@cometchat/chat-uikit-angular';
import { AppComponent } from './app.component';

@NgModule({
imports: [
BrowserModule,
CometChatMessageComposer
],
declarations: [AppComponent],
providers: [],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }

Actions

Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.

1. OnSendButtonClick

The OnSendButtonClick event gets activated when the send message button is clicked. It has a predefined function of sending messages entered in the composer EditText. However, you can overide this action with the following code snippet.

import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

public handleOnSendButtonClick = (message: CometChat.BaseMessage) =>{
console.log("Your Custom send button click actions", message);
};

onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}
2. onError

This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageList component.

import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

public handleOnError = (error: CometChat.CometChatException) => {
console.log("your custom on error action", error);
};

onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

Filters

MessageComposer component does not have any available filters.


Events

Events are emitted by a Component. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.

The list of events emitted by the Messages component is as follows.

EventDescription
ccMessageEditedTriggers whenever a loggedIn user edits any message from the list of messages .it will have three states such as: inProgress, success and error
ccMessageSentTriggers whenever a loggedIn user sends any message, it will have three states such as: inProgress, success and error
ccLiveReactionTriggers whenever a loggedIn clicks on live reaction

Adding CometChatMessageEvents Listener's

import {CometChatMessageEvents} from "@cometchat/chat-uikit-angular";

this.ccMessageEdited = CometChatMessageEvents.ccMessageEdited.subscribe(
() => {
// Your Code
}
);

this.ccMessageSent = CometChatMessageEvents.ccMessageSent.subscribe(
() => {
// Your Code
}
);

this.ccLiveReaction = CometChatMessageEvents.ccLiveReaction.subscribe(
() => {
// Your Code
}
);

Removing CometChatMessageEvents Listener's

this.ccMessageEdited.unsubscribe();
this.ccMessageSent.unsubscribe();

Customization

To fit your app's design requirements, you can customize the appearance of the MessageComposer component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.

Style

Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.

1. MessageComposer Style

To modify the styling, you can apply the MessageComposerStyle to the MessageComposer Component using the messageComposerStyle property.

import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit } from '@cometchat/chat-uikit-angular';
import { MessageComposerStyle } from '@cometchat/uikit-shared';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

messageComposerStyle = new MessageComposerStyle({
AIIconTint:"#ec03fc",
attachIcontint:"#ec03fc",
background:"#fffcff",
border:"2px solid #b30fff",
borderRadius:"20px",
inputBackground:"#e2d5e8",
textColor:"#ff299b",
sendIconTint:"#ff0088",
});
onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

The following properties are exposed by MessageComposerStyle:

PropertyDescriptionCode
borderUsed to set borderborder?: string,
borderRadiusUsed to set border radiusborderRadius?: string;
backgroundUsed to set background colourbackground?: string;
heightUsed to set heightheight?: string;
widthUsed to set widthwidth?: string;
inputBackgroundUsed to set input background colorinputBackground?: string;
inputBorderused to set input borderinputBorder?: string;
inputBorderRadiusused to set input border radiusinputBorderRadius?: string;
textFontUsed to set input text fonttextFont?: string;
textColorused to set input text colortextColor?: string;
placeHolderTextColorUsed to set placeholder text colorplaceHolderTextColor?: string;
placeHolderTextFontUsed to set placeholder text fontplaceHolderTextFont?: string;
attachIcontintUsed to set attachment icon tintattachIcontint?: string;
sendIconTintUsed to set send button icon tintsendIconTint?: string;
dividerTintUsed to set separator colordividerTint?: string;
voiceRecordingIconTintused to set voice recording icon colorvoiceRecordingIconTint?: string;
emojiIconTintused to set emoji icon coloremojiIconTint?: string;
AIIconTintused to set AI icon colorAIIconTint?: string;
emojiKeyboardTextFontused to set emoji keyboard text fontemojiKeyboardTextFont?: string;
previewTitleFontused to set preview title fontpreviewTitleFont?: string;
previewTitleColorused to set preview title colorpreviewTitleColor?: string;
previewSubtitleFontused to set preview subtitle fontpreviewSubtitleFont?: string;
previewSubtitleColorused to set preview subtitle colorpreviewSubtitleColor?: string;
closePreviewTintused to set close preview colorclosePreviewTint?: string;
maxInputHeightused to set max input heightmaxInputHeight?: string;
2. MediaRecorder Style

To customize the styles of the MediaRecorder component within the MessageComposer Component, use the mediaRecorderStyle property. For more details, please refer to MediaRecorder styles.

import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit, MediaRecorderStyle } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

mediaRecorderStyle = new MediaRecorderStyle({
background:"#f2f5fa",
border:"2px solid #be0be6",
closeIconTint:"#830be6",
submitIconTint:"#c2a3ff",
startIconTint:"#a313f0"
});
onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}
3. MentionsWarning Style

To customize the styles of the MentionsWarning within the MessageComposer Component, use the mentionsWarningStyle property.

import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

mentionsWarningStyle: any = ({
backgroundColor:'red',
height:'50px',
width:'200px'
});
onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

Functionality

These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.

import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

Below is a list of customizations along with corresponding code snippets

PropertyDescriptionCode
User report Used to pass user object of which header specific details will be show[user]="userObject"
Group report Used to pass group object of which header specific details will be shown[group]="groupObject"
placeHolderTextUsed to set composer's placeholder textplaceHolderText="your custom placeholder text"
mentionsWarningTextText to be displayed when max limit reaches for valid mentions[mentionsWarningText]="'Your Custom Mentions warning Text'"
disableTypingEventsUsed to disable/enable typing events , default false[disableTypingEvents]="true"
disableSoundForMessagesUsed to toggle sound for outgoing messages[disableSoundForMessages]="true"
sendButtonIconURLUsed to set send button iconsendButtonIconURL="your custom isend button icon url"
textUsed to set predefined texttext="Your custom text"
voiceRecordingStartIconURLSets custom icon for voice recording start.voiceRecordingStartIconURL="your custom voice recording start icon"
voiceRecordingStopIconURLSets custom icon for voice recording stop.voiceRecordingStopIconURL="your custom voice recording stop icon"
voiceRecordingCloseIconURLSets custom icon for voice recording close.voiceRecordingCloseIconURL="your custom voice recording close icon"
voiceRecordingSubmitIconURLSets custom icon for voice recording submitvoiceRecordingSubmitIconURL="your custom voice recording submit icon"
auxiliaryButtonAlignmentcontrols position of auxiliary button view , can be left or right . default rightauxiliaryButtonAlignment=AuxiliaryButtonAlignment.left
attachmentIconURLsets the icon to show in the attachment buttonattachmentIconURL="your custom attachment icon url"
hideLiveReactionused to toggle visibility for live reaction component[hideLiveReaction]="true"
customSoundForMessageUsed to give custom sounds to outgoing messagescustomSoundForMessage="your custom sound for messages"
LiveReactionIconURLused to set custom live reaction icon.LiveReactionIconURL="your custom live reaction icon"
AIIconURLused to set custom AI icon.AIIconURL="your custom AI icon"
emojiIconURLused to set custom emoji icon.emojiIconURL="your custom emoji icon"
hideLayoutModeused to hide the layout mode.[hideLayoutMode]="true"
hideVoiceRecordingused to hide the voice recording option.[hideVoiceRecording]="true"
Disable MentionsSets whether mentions in text should be disabled. Processes the text formatters If there are text formatters available and the disableMentions flag is set to true, it removes any formatters that are instances of CometChatMentionsFormatter.[disableMentions]="true"

Advanced

For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.


AttachmentOptions

By using attachmentOptions, you can set a list of custom MessageComposerActions for the MessageComposer Component. This will override the existing list of MessageComposerActions.

Example

Image
import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit, ComposerId } from '@cometchat/chat-uikit-angular';
import { CometChatMessageComposerAction } from '@cometchat/uikit-resources';

import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}
getAttachmentOptions = (item: CometChat.User | CometChat.Group, composerId: ComposerId)=>{
const CustomAttachment = [
new CometChatMessageComposerAction({
id: 'your custom id',
iconURL: 'icon',
background: 'blue',
title: 'Your Custom Title',
iconTint: '#9000ff'
})
];
if(item instanceof CometChat.User) {
//push user specific custom attachment options
} else if(item instanceof CometChat.Group) {
//push group specific custom attachment options
}
return CustomAttachment;
};

onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

AuxiliaryButtonView

You can insert a custom view into the MessageComposer component to add additional functionality using the following method.

Please note that the MessageComposer Component utilizes the AuxiliaryButton to provide sticker functionality. Overriding the AuxiliaryButton will subsequently replace the sticker functionality.

In this example, we'll be adding a custom SOS button.

Example

Image
import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit, IconStyle } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

name = 'Your Custom name';
auxiliaryButtonURL = 'Your custom url';
getIconStyle = new IconStyle({
iconTint:"#d400ff",
});

onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

SecondaryButtonView

You can add a custom view into the SecondaryButton component for additional functionality using the below method.

In this example, we'll be adding a custom SOS button.

Example

Image
import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit, IconStyle } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

name = 'Your Custom name';
secondaryButtonURL = 'Your custom url';
getIconStyle = new IconStyle({
iconTint:"#d400ff",
});

onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

SendButtonView

You can set a custom view in place of the already existing send button view. Using the following method.

Example

Image
import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit, IconStyle } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}

name = 'Your Custom name';
customURL = 'Your custom url';
getIconStyle = new IconStyle({
iconTint:"#d400ff",
});

onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

HeaderView

You can set custom headerView to the MessageComposer component using the following method

In the following example, we're going to apply a mock chat bot button to the MessageComposer Component using the headerView property.

Example

Image
import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit } from '@cometchat/chat-uikit-angular';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}
myCustomIcon = 'Your custom url';


onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

TextFormatters

Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out CometChatMentionsFormatter.

Example

Image
import { CometChatTextFormatter } from "@cometchat/uikit-shared";
import { Subject } from 'rxjs';
import { CometChat } from "@cometchat/chat-sdk-javascript";

export class ShortcutFormatter extends CometChatTextFormatter {
private shortcuts: { [key: string]: string } = {};
private dialogIsOpen: boolean = false;
private currentShortcut: string | null = null;
private openDialogSubject = new Subject<{ closeDialog?: boolean, buttonText?: string, shortcut?: string, handleButtonClick?:any }>();
openDialog$ = this.openDialogSubject.asObservable();

constructor() {
super();
this.setTrackingCharacter('!');
CometChat.callExtension('message-shortcuts', 'GET', 'v1/fetch', undefined)
.then((data: any) => {
if (data && data.shortcuts) {
this.shortcuts = data.shortcuts;
}
})
.catch(error => console.log("error fetching shortcuts", error));
}

override onKeyDown(event: KeyboardEvent) {
const caretPosition = this.currentCaretPosition instanceof Selection
? this.currentCaretPosition.anchorOffset
: 0;
const textBeforeCaret = this.getTextBeforeCaret(caretPosition);

const match = textBeforeCaret.match(/!([a-zA-Z]+)$/);
if (match) {
const shortcut = match[0];
const replacement = this.shortcuts[shortcut];
if (replacement) {
if (this.dialogIsOpen && this.currentShortcut !== shortcut) {
this.closeDialog();
}
this.openDialog(replacement, shortcut);
}
}
}

getCaretPosition() {
if (!this.currentCaretPosition?.rangeCount) return { x: 0, y: 0 };
const range = this.currentCaretPosition?.getRangeAt(0);
const rect = range.getBoundingClientRect();
return {
x: rect.left,
y: rect.top
};
}

openDialog(buttonText: string, shortcut: string) {
this.openDialogSubject.next({ buttonText, shortcut , handleButtonClick: this.handleButtonClick});
this.dialogIsOpen = true;
this.currentShortcut = shortcut;
}

closeDialog() {
this.openDialogSubject.next({closeDialog: true});
}

handleButtonClick = (buttonText: string) => {
console.log(buttonText);

if (this.currentCaretPosition && this.currentRange) {
const shortcut = Object.keys(this.shortcuts).find(key => this.shortcuts[key] === buttonText);
if (shortcut) {
const replacement = this.shortcuts[shortcut];
this.addAtCaretPosition(replacement, this.currentCaretPosition, this.currentRange);
}
}
if (this.dialogIsOpen) {
this.closeDialog();
}
};

override getFormattedText(text: string): string {
return text;
}

private getTextBeforeCaret(caretPosition: number): string {
if (this.currentRange && this.currentRange.startContainer && typeof this.currentRange.startContainer.textContent === "string") {
const textContent = this.currentRange.startContainer.textContent;
if (textContent.length >= caretPosition) {
return textContent.substring(0, caretPosition);
}
}
return "";
}
}

export default ShortcutFormatter;

Configuration

Configurations offer the ability to customize the properties of each component within a Composite Component.

UserMemberWrapper

From the MessageComposer, you can navigate to the UserMemberWrapper component as shown in the image.

Image

If you wish to modify the properties of the UserMemberWrapper Component, you can use the UserMemberWrapperConfiguration object.

import { CometChat } from '@cometchat/chat-sdk-javascript';
import { Component, OnInit } from '@angular/core';
import { CometChatThemeService, CometChatUIKit } from '@cometchat/chat-uikit-angular';
import { UserMemberWrapperConfiguration } from '@cometchat/uikit-shared';
import { UserPresencePlacement } from '@cometchat/uikit-resources';
import "@cometchat/uikit-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

ngOnInit(): void {
CometChat.getUser("uid").then((user:CometChat.User)=>{
this.userObject=user;
});
}

public userObject!: CometChat.User;

constructor(private themeService:CometChatThemeService) {
themeService.theme.palette.setMode("light")
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" })
}
public userMemberWrapperConfiguration= new UserMemberWrapperConfiguration({
userPresencePlacement: UserPresencePlacement.right,
//properties of UserMemberWrapper
});


onLogin(UID?: any) {
CometChatUIKit.login({ uid: UID }).then(
(user) => {
setTimeout(() => {
window.location.reload();
}, 1000);
},
(error) => {
console.log("Login failed with exception:", { error });
}
);
}
}

The UserMemberWrapperConfiguration indeed provides access to all the Action, Filters, Styles, Functionality, and Advanced properties of the UserMemberWrapper component.

Please note that the properties marked with the report symbol are not accessible within the Configuration Object.

Example

Image

In the above example, we are styling a few properties of the UserMemberWrapper component using UserMemberWrapperConfiguration.