AI Agent Component Spec
AI Agent Component Spec
Where It Fits
CometChatMessageComposer is a Widget 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.

CometChatMessageComposer is comprised of the following Base Widgets:
| Base Widgets | Description |
|---|---|
| MessageInput | This provides a basic layout for the contents of this component, such as the TextField and buttons |
| ActionSheet | The ActionSheet widget presents a list of options in either a list or grid mode |
- Dart
Minimal Render
The simplest way to renderCometChatMessageComposer:
- Dart
Actions and Events
Callback Props
Component-level callbacks that fire on specific user interactions:| Callback | Signature | Fires When |
|---|---|---|
onSendButtonTap | Function(BuildContext, BaseMessage, PreviewMessageMode?)? | User taps the send button |
onChange | Function(String)? | Text in the input field changes |
onError | OnError? | An error occurs |
stateCallBack | Function(CometChatMessageComposerController)? | Controller state callback for accessing controller functions |
- Dart
Custom View Slots
Customize the appearance ofCometChatMessageComposer by replacing default views with your own widgets.
| Slot | Signature | Replaces |
|---|---|---|
auxiliaryButtonView | ComposerWidgetBuilder? | Auxiliary button area (AI, stickers) |
secondaryButtonView | ComposerWidgetBuilder? | Secondary button area (attachment, voice) |
sendButtonView | Widget? | Send button |
headerView | ComposerWidgetBuilder? | Header section above input |
footerView | ComposerWidgetBuilder? | Footer section below input |
attachmentOptions | ComposerActionsBuilder? | Attachment options list |
Example: Custom Auxiliary Button View
- Dart

Example: Custom Secondary Button View
- Dart

Example: Custom Send Button View
- Dart

Example: Custom Header View
- Dart

Example: Custom Footer View
- Dart
- Android
- iOS

Example: Custom Attachment Options
- Dart

Styling
Customize the appearance ofCometChatMessageComposer using CometChatMessageComposerStyle.
Style Properties
| Property | Type | Description |
|---|---|---|
backgroundColor | Color? | Background color of the message composer |
border | BoxBorder? | Border of the message composer |
borderRadius | BorderRadiusGeometry? | Border radius of the message composer |
closeIconTint | Color? | Color for the close icon |
dividerColor | Color? | Color of the divider |
dividerHeight | double? | Height of the divider |
sendButtonIconColor | Color? | Color of the send button icon |
sendButtonIconBackgroundColor | Color? | Background color of the send button |
sendButtonBorderRadius | BorderRadiusGeometry? | Border radius of the send button |
secondaryButtonIconColor | Color? | Color of the secondary button icon |
secondaryButtonIconBackgroundColor | Color? | Background color of the secondary button |
secondaryButtonBorderRadius | BorderRadiusGeometry? | Border radius of the secondary button |
auxiliaryButtonIconColor | Color? | Color of the auxiliary button icon |
auxiliaryButtonIconBackgroundColor | Color? | Background color of the auxiliary button |
auxiliaryButtonBorderRadius | BorderRadiusGeometry? | Border radius of the auxiliary button |
textStyle | TextStyle? | Style of the text |
textColor | Color? | Color of the text |
placeHolderTextStyle | TextStyle? | Style of the placeholder text |
placeHolderTextColor | Color? | Color of the placeholder text |
filledColor | Color? | Background color of the text input |
mentionsStyle | CometChatMentionsStyle? | Style for mentions |
mediaRecorderStyle | CometChatMediaRecorderStyle? | Style for media recorder |
aiOptionStyle | AIOptionsStyle? | Style for AI options |
aiOptionSheetStyle | CometChatAiOptionSheetStyle? | Style for AI option sheet |
attachmentOptionSheetStyle | CometChatAttachmentOptionSheetStyle? | Style for attachment option sheet |
suggestionListStyle | CometChatSuggestionListStyle? | Style for suggestion list |
messagePreviewStyle | CometChatMessagePreviewStyle? | Style for message preview |
Example: Custom Styling
- Dart

Example: Custom Media Recorder Style
- Dart

Example: Custom AI Options Style
- Dart
Advanced
Text Formatters
Assigns the list of text formatters. To configure the existing Mentions look and feel check out CometChatMentionsFormatter.- Dart

Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
user | User? | null | User object for the message composer |
group | Group? | null | Group object for the message composer |
messageComposerStyle | CometChatMessageComposerStyle? | - | Sets style for the message composer |
placeholderText | String? | - | Hint text for the input field |
text | String? | - | Initial text for the input field |
onChange | Function(String)? | - | Callback triggered when text changes |
textEditingController | TextEditingController? | - | Controls the state of the text field |
maxLine | int? | - | Maximum number of lines allowed |
disableMentions | bool? | null | Disables mentions in the composer |
disableTypingEvents | bool | false | Disables typing events |
disableSoundForMessages | bool | false | Disables sound for sent messages |
customSoundForMessage | String? | - | URL for custom sound |
customSoundForMessagePackage | String? | - | Package name for custom sound asset |
parentMessageId | int | 0 | ID of the parent message |
padding | EdgeInsetsGeometry? | - | Sets padding for the message composer |
messageInputPadding | EdgeInsetsGeometry? | - | Sets padding for the message input field |
sendButtonView | Widget? | - | Custom send button widget |
attachmentIcon | Widget? | - | Custom attachment icon |
attachmentIconURL | String? | - | Path of the icon to show in the attachments button |
voiceRecordingIcon | Widget? | - | Custom voice recording icon |
aiIcon | Widget? | - | Custom AI button icon |
aiIconURL | String? | - | Path of the icon to show in the AI button |
aiIconPackageName | String? | - | Package name for AI icon asset |
auxiliaryButtonView | ComposerWidgetBuilder? | - | UI component for auxiliary button |
secondaryButtonView | ComposerWidgetBuilder? | - | UI component for secondary button |
auxiliaryButtonsAlignment | AuxiliaryButtonsAlignment? | - | Controls position of auxiliary button view |
hideVoiceRecordingButton | bool? | null | Hide/display voice recording button |
attachmentOptions | ComposerActionsBuilder? | - | Provides options for file attachments |
hideAttachmentButton | bool? | null | Hide/display attachment button |
hideImageAttachmentOption | bool? | null | Hide/display image attachment option |
hideVideoAttachmentOption | bool? | null | Hide/display video attachment option |
hideAudioAttachmentOption | bool? | null | Hide/display audio attachment option |
hideFileAttachmentOption | bool? | null | Hide/display file attachment option |
hidePollsOption | bool? | null | Hide/display polls option |
hideCollaborativeDocumentOption | bool? | null | Hide/display collaborative document option |
hideCollaborativeWhiteboardOption | bool? | null | Hide/display collaborative whiteboard option |
hideTakePhotoOption | bool? | null | Hide/display take photo option |
onSendButtonTap | Function(...)? | - | Callback when send button is tapped |
onError | OnError? | - | Callback to handle errors |
hideSendButton | bool? | null | Hide/display the send button |
hideStickersButton | bool? | null | Hide/display the sticker button |
sendButtonIcon | Widget? | - | Custom send button icon |
recorderStartButtonIcon | Widget? | - | Custom icon for media recorder start button |
recorderPauseButtonIcon | Widget? | - | Custom icon for media recorder pause button |
recorderDeleteButtonIcon | Widget? | - | Custom icon for media recorder delete button |
recorderStopButtonIcon | Widget? | - | Custom icon for media recorder stop button |
recorderSendButtonIcon | Widget? | - | Custom icon for media recorder send button |
disableMentionAll | bool | false | Disables @all mentions in groups |
mentionAllLabel | String? | - | Custom label for group mentions |
mentionAllLabelId | String? | - | Custom label ID for group mentions |
headerView | ComposerWidgetBuilder? | - | Custom header view |
footerView | ComposerWidgetBuilder? | - | Custom footer view |
textFormatters | List<CometChatTextFormatter>? | - | List of text formatters |
stateCallBack | Function(CometChatMessageComposerController)? | - | Callback to access controller functions |
