Skip to main content
The CometChatSavedMessages component lists the messages the logged-in user has saved, newest first, gathered from every conversation they take part in. Saving is private: a saved message is visible only to the user who saved it, and no one else in the conversation is told.

Overview

The Saved Messages panel provides:
  • Cross-conversation list: Every save the user has made, regardless of which chat it came from
  • Conversation-style rows: Each row shows the source conversation’s avatar and name, with the speaker named in the subtitle — the same shape the conversation list uses
  • Rich previews: Media messages name their type behind a matching icon, captions win over type labels, and thread replies are marked
  • Inline unsave: A per-row unsave control, behind a confirmation dialog
  • Paged loading: 30 rows per page, fetching the next page as you scroll
  • Live updates: Saves and unsaves made elsewhere in the app are reflected without a refetch
  • Focus trap: Traps keyboard focus within the panel for modal-like behavior
Save Message is gated by the features.ux.messages.saved.enabled app setting, which CometChat provisions server-side. Until it is on, CometChat.isSaveMessageEnabled() resolves false and the save surfaces do not render. See Enabling Pin and Save for the development override.
Live Preview — saved messages drawn from several conversations, newest save first. Open in Storybook ↗

Basic Usage

Simple Saved Messages Panel

The panel is scoped to the logged-in user, so it takes no conversation input. Because a save spans every conversation, place it in your app chrome rather than in a chat header.

Read-Only Panel

Hide the unsave control when the panel is used purely for navigation.

Custom Empty State

Filtering

Pass a messagesRequestBuilder to customize the fetch — the page size, most commonly. Call setSaved(true) on the builder: it is what scopes the request to the logged-in user’s saved messages, and without it the request is an ordinary history read.
The component re-asserts setSaved(true) on whatever builder you pass, so it is safe even if you omit it — but keep it in your code to make the intent explicit. Do not scope the builder to a UID or GUID: saves span every conversation.

Properties

Events

Behavior

Privacy

savedAt is per-viewer: it is only ever populated on the acting user’s own copy of a message. Saving a message therefore tells no one, and this panel never shows another user’s saves. Save events arrive only on the acting user’s own devices, which is what keeps a save in sync across their sessions.

Row Identity

A saved message is shown under the conversation it came from — a group’s name and icon, or the other party in a one-on-one — with the speaker named in the subtitle. Source names are resolved once and cached, and the raw ID shows until a name arrives, so a row is never withheld waiting on it.

Confirmation

Unsaving asks for confirmation; saving does not.

Pagination

The first page is 30 rows and the next is fetched as the list nears its end. A page that yields nothing new stops further loading, so a repeated page cannot spin.

Customization

CSS Variables

Accessibility

Keyboard Navigation

  • Escape dismisses the confirmation dialog if one is open, otherwise the panel
  • Tab cycles within the panel; focus does not escape to the page behind it
  • Enter / Space on a row activates it, as a click does

Focus Management

Focus is trapped on open and released on destroy, so the panel behaves as a modal surface while it is up.

Screen Reader Support

  • The panel is a labelled region
  • Rows are exposed as buttons
  • Loading, empty, and error states are announced via role="status"
  • Media-type icons, thread markers, and illustrations are aria-hidden; the preview text carries the meaning