AI Agent Component Spec
AI Agent Component Spec
Where It Fits
CometChatCompactMessageComposer is a Widget that provides a streamlined, modern messaging input experience. It features a pill-shaped compose box with an inline rich text formatting toolbar, voice recording, attachments, mentions, and auxiliary actions like stickers.
Compared to CometChatMessageComposer, the compact variant offers:
- A rounded, pill-shaped input field
- An inline rich text formatting toolbar displayed below the input
- Configurable Enter key behavior (send message or new line)
- Text selection context menu with formatting options
- Inline audio recorder that replaces the compose box during recording

- Dart
Minimal Render
The simplest way to renderCometChatCompactMessageComposer:
- 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 |
onToolbarVisibilityChange | void Function(bool isVisible)? | Rich text toolbar visibility changes |
onMentionLimitReached | void Function(int limit)? | Mention limit is exceeded |
onEditCancel | void Function()? | Edit mode is cancelled |
stateCallBack | Function(CometChatCompactMessageComposerController)? | Controller state callback for accessing controller functions |
- Dart
Rich Text Formatting
CometChatCompactMessageComposer includes built-in rich text formatting support with an inline toolbar displayed below the input field.
Configuration
| Prop | Type | Default | Description |
|---|---|---|---|
enableRichTextFormatting | bool | true | Master switch for rich text formatting. When false, toolbar and text selection menu items are disabled |
showRichTextFormattingOptions | bool | true | Controls whether the rich text toolbar is visible above the composer. Only works when enableRichTextFormatting is true |
showTextSelectionMenuItems | bool | true | Controls whether formatting options appear in the text selection context menu. Only works when enableRichTextFormatting is true |
hideRichTextFormattingOptions | Set<FormatType>? | null | Specifies which format types to hide from the rich text toolbar |
richTextToolbarStyle | CometChatRichTextToolbarStyle? | - | Custom styling for the rich text toolbar |
- Dart
Enter Key Behavior
Configure what happens when the Enter key is pressed using theenterKeyBehavior prop.
| Value | Behavior |
|---|---|
EnterKeyBehavior.newLine | Inserts a new line (default) |
EnterKeyBehavior.sendMessage | Sends the message immediately |
- Dart
Custom View Slots
Customize the appearance ofCometChatCompactMessageComposer by replacing default views with your own widgets.
| Slot | Signature | Replaces |
|---|---|---|
auxiliaryButtonView | ComposerWidgetBuilder? | Auxiliary button area (stickers, emoji) |
headerView | ComposerWidgetBuilder? | Header section above the composer |
footerView | ComposerWidgetBuilder? | Footer section below the composer |
attachmentOptions | ComposerActionsBuilder? | Attachment options list |
Example: Custom Auxiliary Button View
- Dart
Example: Custom Header View
- Dart
Example: Custom Footer View
- Dart
Example: Custom Attachment Options
- Dart
Styling
Customize the appearance ofCometChatCompactMessageComposer using CometChatCompactMessageComposerStyle.
Style Properties
| Property | Type | Description |
|---|---|---|
backgroundColor | Color? | Background color of the outer composer container |
border | BoxBorder? | Border of the outer composer container |
borderRadius | BorderRadiusGeometry? | Border radius of the outer composer container |
composeBoxBackgroundColor | Color? | Background color of the pill-shaped compose box |
composeBoxBorderRadius | BorderRadiusGeometry? | Border radius of the compose box |
composeBoxBorder | BoxBorder? | Border of the compose box |
textStyle | TextStyle? | Style of the input text |
textColor | Color? | Color of the input text |
placeholderTextStyle | TextStyle? | Style of the placeholder text |
placeholderTextColor | Color? | Color of the placeholder text |
sendButtonIconColor | Color? | Color of the send button icon when enabled |
sendButtonBackgroundColor | Color? | Background color of the send button when enabled |
sendButtonDisabledIconColor | Color? | Color of the send button icon when disabled |
sendButtonDisabledBackgroundColor | Color? | Background color of the send button when disabled |
sendButtonBorderRadius | BorderRadiusGeometry? | Border radius of the send button |
attachmentButtonIconColor | Color? | Color of the attachment button icon |
attachmentButtonBackgroundColor | Color? | Background color of the attachment button |
attachmentButtonBorderRadius | BorderRadiusGeometry? | Border radius of the attachment button |
voiceRecordingButtonIconColor | Color? | Color of the voice recording button icon |
voiceRecordingButtonBackgroundColor | Color? | Background color of the voice recording button |
voiceRecordingButtonBorderRadius | BorderRadiusGeometry? | Border radius of the voice recording button |
richTextToggleIconColor | Color? | Color of the rich text toggle icon when inactive |
richTextToggleActiveIconColor | Color? | Color of the rich text toggle icon when active |
richTextToggleBackgroundColor | Color? | Background color of the rich text toggle when inactive |
richTextToggleActiveBackgroundColor | Color? | Background color of the rich text toggle when active |
richTextToggleBorderRadius | BorderRadiusGeometry? | Border radius of the rich text toggle button |
auxiliaryButtonIconColor | Color? | Color of auxiliary button icons |
auxiliaryButtonBackgroundColor | Color? | Background color of auxiliary buttons |
auxiliaryButtonBorderRadius | BorderRadiusGeometry? | Border radius of auxiliary buttons |
dividerColor | Color? | Color of dividers |
dividerHeight | double? | Height of dividers |
closeIconTint | Color? | Color of the close icon in the preview banner |
Nested Styles
| Property | Type | Description |
|---|---|---|
richTextToolbarStyle | CometChatRichTextToolbarStyle? | Style for the rich text formatting toolbar |
richTextFormatterStyle | CometChatRichTextFormatterStyle? | Style for rich text formatting in the input field |
messagePreviewStyle | CometChatMessagePreviewStyle? | Style for the message preview (edit/reply banner) |
mentionsStyle | CometChatMentionsStyle? | Style for mentions |
suggestionListStyle | CometChatSuggestionListStyle? | Style for the suggestion list |
mediaRecorderStyle | CometChatMediaRecorderStyle? | Style for the media recorder |
attachmentOptionSheetStyle | CometChatAttachmentOptionSheetStyle? | Style for the attachment option sheet |
Example: Custom Styling
- Dart
Example: Custom Compose Box Styling
- Dart
Example: Custom Rich Text Toolbar Style
- Dart
Example: Custom Media Recorder Style
- Dart
Advanced
Text Formatters
Assigns the list of text formatters. To configure the existing Mentions look and feel check out CometChatMentionsFormatter.- Dart
Mention Configuration
| Prop | Type | Default | Description |
|---|---|---|---|
disableMentions | bool | false | Disables the mention suggestion list |
disableMentionAll | bool | false | Disables the @all option in mention suggestions |
mentionAllLabel | String? | - | Custom label for @all mention |
mentionAllLabelId | String? | - | Custom label ID for @all mention |
- Dart
Custom Icons
| Prop | Type | Description |
|---|---|---|
attachmentIcon | Widget? | Custom icon for the attachment button |
voiceRecordingIcon | Widget? | Custom icon for the voice recording button |
sendButtonIcon | Widget? | Custom icon for the send button |
recorderStartButtonIcon | Widget? | Custom icon for the recorder start/play button |
recorderPauseButtonIcon | Widget? | Custom icon for the recorder pause button |
recorderDeleteButtonIcon | Widget? | Custom icon for the recorder delete button |
recorderStopButtonIcon | Widget? | Custom icon for the recorder stop button |
recorderSendButtonIcon | Widget? | Custom icon for the recorder send button |
- 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 |
compactMessageComposerStyle | CometChatCompactMessageComposerStyle? | - | Sets style for the compact message composer |
enableRichTextFormatting | bool | true | Master switch for rich text formatting |
showRichTextFormattingOptions | bool | true | Controls rich text toolbar visibility |
showTextSelectionMenuItems | bool | true | Controls formatting options in text selection menu |
hideRichTextFormattingOptions | Set<FormatType>? | null | Format types to hide from the toolbar |
richTextToolbarStyle | CometChatRichTextToolbarStyle? | - | Custom styling for the rich text toolbar |
placeholderText | String? | - | Hint text for the input field |
maxLine | int | 4 | Maximum number of lines the input can expand to |
text | String? | - | Initial text for the input field |
textEditingController | TextEditingController? | - | Controls the state of the text field |
enterKeyBehavior | EnterKeyBehavior | EnterKeyBehavior.newLine | Defines Enter key behavior (send or new line) |
hideAttachmentButton | bool | false | Hides the attachment button |
hideVoiceRecordingButton | bool | false | Hides the voice recording button |
hideSendButton | bool | false | Hides the send button |
hideImageAttachmentOption | bool | false | Hides the image attachment option |
hideVideoAttachmentOption | bool | false | Hides the video attachment option |
hideAudioAttachmentOption | bool | false | Hides the audio attachment option |
hideFileAttachmentOption | bool | false | Hides the file attachment option |
hidePollsOption | bool | false | Hides the polls option |
hideCollaborativeDocumentOption | bool | false | Hides the collaborative document option |
hideCollaborativeWhiteboardOption | bool | false | Hides the collaborative whiteboard option |
hideTakePhotoOption | bool | false | Hides the take photo option |
hideStickersButton | bool | false | Hides the stickers button |
disableMentions | bool | false | Disables mentions in the composer |
disableMentionAll | bool | false | Disables @all mentions in groups |
mentionAllLabel | String? | - | Custom label for group mentions |
mentionAllLabelId | String? | - | Custom label ID for group mentions |
disableTypingEvents | bool | false | Disables typing indicator 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 for threads |
onChange | Function(String)? | - | Callback triggered when text changes |
onSendButtonTap | Function(...)? | - | Callback when send button is tapped |
onError | OnError? | - | Callback to handle errors |
onToolbarVisibilityChange | void Function(bool)? | - | Callback when toolbar visibility changes |
onMentionLimitReached | void Function(int)? | - | Callback when mention limit is exceeded |
onEditCancel | void Function()? | - | Callback when edit mode is cancelled |
stateCallBack | Function(CometChatCompactMessageComposerController)? | - | Callback to access controller functions |
auxiliaryButtonView | ComposerWidgetBuilder? | - | Custom auxiliary button widget |
headerView | ComposerWidgetBuilder? | - | Custom header view |
footerView | ComposerWidgetBuilder? | - | Custom footer view |
attachmentOptions | ComposerActionsBuilder? | - | Custom attachment options |
textFormatters | List<CometChatTextFormatter>? | - | List of text formatters |
attachmentIcon | Widget? | - | Custom attachment icon |
voiceRecordingIcon | Widget? | - | Custom voice recording icon |
sendButtonIcon | Widget? | - | Custom send button icon |
recorderStartButtonIcon | Widget? | - | Custom recorder start button icon |
recorderPauseButtonIcon | Widget? | - | Custom recorder pause button icon |
recorderDeleteButtonIcon | Widget? | - | Custom recorder delete button icon |
recorderStopButtonIcon | Widget? | - | Custom recorder stop button icon |
recorderSendButtonIcon | Widget? | - | Custom recorder send button icon |
Message Composer
The standard message composer component
Message Header
Display user or group details in the header
Message List
Display messages in a conversation
Mentions Formatter
Configure mentions look and feel