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.
Usage
Integration
The following code snippet illustrates how you can directly incorporate the MessageComposer component into your file.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
TheOnSendButtonClick event gets activated when the send message button is clicked. The following code snippet Overrides the action of the send button in CometChatMessageComposer.
- Swift
Filters
MessageComposer component does not have any available filters.Events
Events are emitted by aComponent. 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 MessageComposer Component does not emit any events of its own.
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 customize the styling, you can apply theMessageComposerStyle to the MessageComposer component.
- Swift
2. MediaRecorder Style
To customize the styles of the MediaRecorder component within the MessageComposer Component, use the.set(mediaRecorderStyle:) method. For more details, please refer to MediaRecorder styles.
- Swift
3. AI Options Style
To customize the styles of the MediaRecorder component within the MessageComposer Component, use the.set(aiOptionsStyle:) method. For more details, please refer to MediaRecorder styles.
- Swift
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.- Swift

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.SetTextFormatters
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
- Swift
AttachmentOptions
By usingsetAttachmentOptions(), you can set a list of custom MessageComposerActions for the MessageComposer Component. This will override the existing list of MessageComposerActions.
- Swift

- Swift
AuxiliaryButtonView
You can insert a custom view into the MessageComposer component to add additional functionality using the following method.- Swift
.setAuxiliaryButtonView() function.
Swift
SecondaryButtonView
You can add a custom view into the SecondaryButton component for additional functionality using the below method.- Swift

.setSecondaryButtonView() function.
Swift
Set SendButtonView
You can set a custom view in place of the already existing send button view. Using the following method.- Swift
- Swift
HeaderView
You can set custom headerView to the MessageComposer component using the following method- Swift

.set(headerView: UIView?) method.
Custom_View_file
- Swift
Ensure to pass and present
cometChatMessages. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.FooterView
You can set a custom footer view to the MessageComposer component using the following method:- Swift

.set(footerView: UIView?) method.
Custom_View_file
- Swift
Ensure to pass and present
cometChatMessages. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.