AI Integration Quick Reference
AI Integration Quick Reference
Where It Fits
CometChatMessageComposer 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.
Wire it alongside CometChatMessageHeader and CometChatMessageList to build a standard chat view.

Minimal Render
Actions and Events
Callback Props
onSendButtonPress
Fires when the send message button is clicked. Overrides the default send behavior.onError
Fires on internal errors (network failure, auth issue, SDK exception).onTextChange
Fires as the user types in the composer input.Global UI Events
CometChatUIEventHandler emits events subscribable from anywhere in the application. Add listeners and remove them on cleanup.
| Event | Fires when | Payload |
|---|---|---|
ccMessageSent | A message is sent | { message: CometChat.BaseMessage, status: string } |
ccMessageEdited | A message is edited | { message: CometChat.BaseMessage, status: string } |
ccMessageLiveReaction | User clicks on live reaction | object |
In React 18 StrictMode,
useEffect runs twice on mount in development. The component handles listener cleanup internally, but any additional listeners added alongside the component need cleanup in the useEffect return function to avoid duplicate event handling.Custom View Slots
Each slot replaces a section of the default UI. Slots that accept parameters receive the relevant data for customization.| Slot | Signature | Replaces |
|---|---|---|
HeaderView | ({ user, group }) => JSX.Element | Area above the composer input |
AuxiliaryButtonView | ({ user, group, composerId }) => JSX.Element | Sticker button area |
SendButtonView | ({ user, group, composerId }) => JSX.Element | Send button |
attachmentOptions | CometChatMessageComposerAction[] | Default attachment options list |
textFormatters | CometChatTextFormatter[] | Text formatting in composer |
textFormatters
Custom text formatters for the composer input. To configure the existing Mentions look and feel check out CometChatMentionsFormatter.
attachmentOptions
Override the default attachment options with custom actions.
addAttachmentOptions
Extends the default attachment options with additional actions.AuxiliaryButtonView
Replace the sticker button area with a custom view.The MessageComposer Component utilizes the AuxiliaryButton to provide sticker functionality. Overriding the AuxiliaryButton will replace the sticker functionality.

SendButtonView
Replace the send button with a custom view.
HeaderView
Custom view above the composer input.
Styling
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.
Visibility Props
| Property | Description | Code |
|---|---|---|
user | User object for 1-on-1 conversation | user={chatUser} |
group | Group object for group conversation | group={chatGroup} |
disableTypingEvents | Disable/enable typing events | disableTypingEvents={true} |
disableSoundForOutgoingMessages | Toggle sound for outgoing messages | disableSoundForOutgoingMessages={true} |
initialComposertext | Set predefined text | initialComposertext="Your custom text" |
customSoundForOutgoingMessage | Custom sound for outgoing messages | customSoundForOutgoingMessage="your-sound" |
hideVoiceRecordingButton | Hide voice recording option | hideVoiceRecordingButton={true} |
hideCameraOption | Hide camera option from attachments | hideCameraOption={true} |
hideImageAttachmentOption | Hide image attachment option | hideImageAttachmentOption={true} |
hideVideoAttachmentOption | Hide video attachment option | hideVideoAttachmentOption={true} |
hideAudioAttachmentOption | Hide audio attachment option | hideAudioAttachmentOption={true} |
hideFileAttachmentOption | Hide file attachment option | hideFileAttachmentOption={true} |
hidePollsAttachmentOption | Hide polls attachment option | hidePollsAttachmentOption={true} |
hideCollaborativeDocumentOption | Hide collaborative document option | hideCollaborativeDocumentOption={true} |
hideCollaborativeWhiteboardOption | Hide collaborative whiteboard option | hideCollaborativeWhiteboardOption={true} |
hideAttachmentButton | Hide attachment button | hideAttachmentButton={true} |
hideStickersButton | Hide stickers button | hideStickersButton={true} |
hideSendButton | Hide send button | hideSendButton={true} |
hideAuxiliaryButtons | Hide auxiliary buttons | hideAuxiliaryButtons={true} |
disableMentions | Disable mentions functionality | disableMentions={true} |
disableMentionAll | Disable @all mention | disableMentionAll={true} |
mentionAllLabel | Custom label for @all mention | mentionAllLabel="everyone" |
imageQuality | Image quality for camera (1-100) | imageQuality={50} |
auxiliaryButtonsAlignment | Alignment of auxiliary buttons | auxiliaryButtonsAlignment="right" |