AI Integration Quick Reference
AI Integration Quick Reference
CometChatMentionsFormatter extends CometChatTextFormatter to format @mentions in text messages. It styles mention tokens, generates suggestion lists as users type, and handles click events on rendered mentions.
Usage
1. Initialize the formatter
2. Format a message
Provide the raw message string containing mention placeholders, then apply the formatter:3. Pass to components
Use thetextFormatters input on cometchat-message-list, cometchat-message-composer, or cometchat-conversations.
The
CometChatMentionsFormatter is included by default in the message composer and message list. You only need to pass it explicitly if you want to customize its behavior or combine it with other formatters.Customization
Custom mention styles
Override the default mention token styles using CSS. The formatter applies BEM classes that you can target:Configuring the formatter
Set the logged-in user so the formatter can distinguish self-mentions:Next Steps
Custom Text Formatter
Build custom inline text patterns.
Message List
Render real-time message threads.
All Guides
Browse all feature and formatter guides.
URL Formatter
Auto-detect and style URLs as clickable links.