Skip to main content

Goal

By the end of this guide you will have a chat screen where users can pin a message so it’s highlighted for everyone in the conversation, open a panel of all pinned messages, and save a message privately to their own list — with a dedicated “Saved” screen to review saves across every conversation. Pin and save are two separate concepts:

Prerequisites

  • Completed the Integration Guide
  • A running CometChatProvider setup with valid credentials
  • An existing chat screen using CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer
  • Pin messages and Save messages enabled for your app through the features.ux.messages.pinned.enabled and features.ux.messages.saved.enabled app settings. See Core Features → Pin & Save.
The pin/unpin and save/unsave options only appear in the message options menu when the corresponding feature is enabled for your app. The UI Kit reads that setting at login, so no extra wiring is needed to show or hide the options.

Step 1: The Message Options

Once the features are enabled, CometChatMessageList automatically adds Pin, Unpin, Save, and Unsave to the message options menu — no props required. You only need the hide* props if you want to remove one: File: ChatScreen.tsx
Who can pin is enforced by the SDK based on the conversation and the user’s role (group owners, admins, and moderators can pin in a group). See the Message List options.

Step 2: Open the Pinned Messages Panel

CometChatMessageHeader exposes a pinned-messages action in its overflow menu. Wire onPinnedMessagesClicked to show CometChatPinnedMessages, scoped to the same user/group. File: ChatScreen.tsx
The pinned-messages action only appears in the header when pinning is enabled (the features.ux.messages.pinned.enabled app setting) and you provide onPinnedMessagesClicked. Use hidePinnedMessagesOption on the header to remove it explicitly.

Step 3: Add a “Saved” Screen

Saves are personal and span every conversation, so CometChatSavedMessages takes no user/group and is not opened from a built-in menu. Mount it wherever your app wants a “Saved” destination — a route, a tab, or a panel toggled from your own button. File: AppShell.tsx

Step 4: Pinned & Saved Indicators

Pinned and saved messages render an indicator on the bubble in the main message list, so users can see a message’s status inline. This is automatic — no configuration needed. See Message Bubble → Pinned & Saved indicators.
Live Preview — a bubble carrying both the pinned and saved indicators.Open in Storybook ↗

Step 5: Limits

Your app can cap how many messages may be pinned or saved. These caps are configured as app settings in the dashboard: When a user hits a cap, the UI Kit shows a toast explaining the limit — you don’t need to handle the error yourself. The kit reads these settings at login so the toast can name the exact cap.

Complete Example

File: App.tsx

Next Steps