Skip to main content
Mentions are on by default. Typing @ in the composer lists the people you can mention — users in a one-to-one chat, the group’s members in a group, with @all first in a group. A picked mention is sent as <@uid:UID> and drawn as @Name everywhere the message appears. CometChatMentionsFormatter is the formatter that does it; you configure it, or pass your own.

Usage

1. Create the formatter

2. Pass it to a component

The composer’s textFormatters replaces its list — nil, the default, is one mentions formatter. Keep yours in @State so it is not rebuilt on every render:
TeamComposer.swift
The message list makes its own mentions formatter; configure mention-all there directly:
In both toolkits a mention always starts with @ (a custom tracking character is ignored), and mention-all shows as @ and its id — @all.

Mention Click Handling

A picked suggestion in the composer:
A tapped mention in a message bubble does nothing by default. In SwiftUI, take the tap by registering the text bubble factory with a callback:
The handler receives the mentioned user as a ChatUser. The UIKit list has no mention tap.

Styling Mentions

Composer mention style

In the input, a mention of someone else is drawn in the theme’s primary and a mention of you in warning. Change them through the theme — see Theming.

Message bubble mention style

A mention of someone else uses the text bubble’s mentionColor, with a 20 % tint behind it; a mention of you, and @all, stay warning:

Conversations mention style

The last-message line runs the formatters, so a mention reads @Name. Colour it:

Customization Matrix

Next Steps

Text Formatter Base Class

Write your own formatter

Message Composer

The composer’s mention options

Message List

Bubble factories and styles

All Guides

Browse the other guides