Skip to main content
CometChatTextFormatter is an abstract class for formatting text in the message composer and message bubbles. Extend it to build custom formatters — hashtags, keywords, or any regex-based pattern.

Steps

1. Import the base class

2. Extend CometChatTextFormatter

3. Configure tracking character and regex

Set the character that triggers formatting and the regex to match.

4. Implement required methods

5. Customize message bubble styling


Example

A hashtag formatter used with CometChatMessageList and CometChatMessageComposer.

Methods Reference


Override Methods

Initialize the formatter. Called when the formatter is first used.

Built-in Formatters

Flutter UI Kit includes these pre-built formatters:

Next Steps

Mentions Formatter

Add @mentions with styled tokens.

Custom Mentions Formatter

Build a custom mentions formatter with filtered suggestions.

Message Composer

Customize the message input component.

All Guides

Browse all feature and formatter guides.

Sample App

Full working sample application on GitHub.