Introduction
Bring your chat conversations to life withCometChatMentionsTextFormatter
. This class allows you to transform user mentions into clickable elements, enriching the communication experience and making it easy for users to notice and interact with each other within the chat.
Features
- Auto-detected Mentions: Automatically finds and highlights mentions in messages.
- Clickable: Makes each mention a clickable entity, enabling further user interaction.
- Customizable: Offers the flexibility to style mentions to fit the design of your chat UI.
Usage Guide
Setup the Formatter
To get started, import and initialize the mentions formatter:Process Chat Messages
When rendering messages in the UI, apply the formatter to process mentions:formattedMessage
now contains HTML with styled mentions that can be directly inserted into your message component.
UserMentionStyle
Styling properties forCometChatMentionsTextFormatter
component.
Attributes | Type | Description |
---|---|---|
mentionTextFont | string | Sets font for mentions |
mentionTextColor | string | Sets color for mentions |
mentionTextBackground | string | Sets background for mentions |
loggedInUserTextFont | string | Sets font for loggedIn user mentions |
loggedInUserTextColor | string | Sets color for loggedIn user mentions |
loggedInUserTextBackground | string | Sets background for loggedIn user mentions |