Skip to main content
CometChatUrlFormatter extends CometChatTextFormatter to detect URLs in text messages and render them as clickable links.

Usage

Extend CometChatTextFormatter, set a regex pattern for URL detection, and override format() to handle formatting and click behavior.

Customization

Apply CSS to your link class:

Handling clicks

Override onUrlClick to add tracking or custom navigation:
The CometChatUrlFormatter is included by default in the message list. You only need to pass it explicitly if you want to customize click behavior or combine it with other formatters.

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.

Mentions Formatter

Add @mentions with styled tokens.