AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-angular |
| Key class | CometChatMentionsFormatter (extends CometChatTextFormatter) |
| Required setup | CometChatUIKit.init(uiKitSettings) then CometChatUIKit.login("UID") |
| Purpose | Format @mentions with styled tokens, suggestion list, and click handling for users and group members |
| Related | Custom Text Formatter | All Guides |
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.
| Capability | Description |
|---|---|
| Mention formatting | Auto-formats <@uid:...> placeholders into styled tokens |
| Custom styles | Colors, fonts, and backgrounds for mention text |
| User and group mentions | Works with both individual users and group members |
| Suggestion list | Generates mention candidates from user input |
| Click handling | Listener interface for tap/click 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 by setting CSS properties:Custom click handler
Handle clicks on mention tokens to navigate to user profiles or show details: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.