Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-react-js-campaigns-notification-feed.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
CometChatNotificationFeed displays a scrollable notification feed where each item is rendered as a card using @cometchat/cards-react. It handles fetching, pagination, category filtering, timestamp grouping, real-time updates, and read/delivered/engagement reporting automatically.
Where It Fits
CometChatNotificationFeed is a full-screen component. Drop it into a page or route. It manages its own data fetching, state, and real-time listeners — you just handle navigation callbacks.
Minimal Render
CometChatUIKit.init() and a user logged in.
Root CSS class: .cometchat-notification-feed
Filtering Feed Items
Control what loads using custom request builders:Filter Options
| Builder Method | Description |
|---|---|
.setLimit(number) | Items per page (default 20, max 100) |
.setReadState(state) | "read", "unread", or "all" |
.setCategory(string) | Filter by category label |
.setChannelId(string) | Filter by channel |
.setTags(string[]) | Filter by tags |
.setDateFrom(string) | ISO 8601 date lower bound |
.setDateTo(string) | ISO 8601 date upper bound |
Actions and Events
Callback Props
onItemClick
Fires when a feed item card is clicked.onActionClick
Fires when an interactive element (button, link) inside a card is clicked. Theaction object contains the action type, parameters, and the element ID that triggered it.
onError
Fires when an internal error occurs (network failure, SDK exception).onBackPress
Fires when the back button in the header is clicked.Automatic Behaviors
The component handles these automatically — no manual setup needed:| Behavior | Description |
|---|---|
| Real-time updates | New items appear at the top via WebSocket NotificationFeedListener |
| Delivery reporting | Items are reported as delivered when fetched |
| Read reporting | Items are reported as read when visible in viewport (IntersectionObserver) |
| Unread count polling | Polls unread count every 30 seconds to update badges |
| Infinite scroll | Fetches next page when scrolling near the bottom |
| Timestamp grouping | Groups items as “Today”, “Yesterday”, day name, or date |
| Category filtering | Filter chips row with per-category unread badges |
| Mark all read | Header button to mark all notifications as read |
| Offline banner | Shows connectivity warning when offline |
Custom View Slots
headerView
Replace the entire header:State Views
Styling
The component uses CSS variables from the CometChat theme system. Pass astyle prop for programmatic overrides, or use CSS classes for full control.
Style Prop
Style Properties
| Property | Type | Description |
|---|---|---|
backgroundColor | string | Root container background |
width | string | Container width |
height | string | Container height |
headerTitleColor | string | Header title text color |
headerTitleFont | string | Header title font |
chipActiveBackgroundColor | string | Selected filter chip background |
chipActiveTextColor | string | Selected filter chip text color |
chipInactiveBackgroundColor | string | Unselected filter chip background |
chipInactiveTextColor | string | Unselected filter chip text color |
chipBorderColor | string | Inactive chip border color |
badgeBackgroundColor | string | Badge background color |
badgeTextColor | string | Badge text color |
separatorColor | string | Separator between items |
timestampTextColor | string | Timestamp text color |
timestampFont | string | Timestamp font |
cardBackgroundColor | string | Card container background |
cardBorderColor | string | Card border color |
cardBorderRadius | number | Card corner radius |
cardBorderWidth | number | Card border width |
unreadIndicatorColor | string | Unread dot color |
CSS Classes
Override styles using these CSS classes:| Class | Description |
|---|---|
.cometchat-notification-feed | Root container |
.cometchat-notification-feed__header | Header bar |
.cometchat-notification-feed__header-title | Header title text |
.cometchat-notification-feed__header-back | Back button |
.cometchat-notification-feed__mark-all-read | Mark all read button |
.cometchat-notification-feed__chips | Filter chips container |
.cometchat-notification-feed__chip | Individual filter chip |
.cometchat-notification-feed__chip--active | Active filter chip |
.cometchat-notification-feed__chip--inactive | Inactive filter chip |
.cometchat-notification-feed__chip--inactive-with-badge | Inactive chip with unread badge |
.cometchat-notification-feed__chip-badge | Chip unread badge |
.cometchat-notification-feed__chip-badge--active | Active chip badge |
.cometchat-notification-feed__chip-badge--inactive | Inactive chip badge |
.cometchat-notification-feed__content | Scrollable content area |
.cometchat-notification-feed__item | Feed item container |
.cometchat-notification-feed__item--unread | Unread feed item |
.cometchat-notification-feed__unread-indicator | Unread dot indicator |
.cometchat-notification-feed__item-meta | Item metadata row (category + time) |
.cometchat-notification-feed__item-category | Category label |
.cometchat-notification-feed__item-time | Timestamp |
.cometchat-notification-feed__card-container | Card wrapper |
.cometchat-notification-feed__loading | Loading state |
.cometchat-notification-feed__empty | Empty state |
.cometchat-notification-feed__error | Error state |
.cometchat-notification-feed__connectivity-banner | Offline banner |
Props
All props are optional.cardThemeMode
Theme mode for the card renderer (@cometchat/cards-react).
| Type | "auto" | "light" | "dark" |
| Default | "auto" |
cardThemeOverride
Custom theme override passed to the card renderer.| Type | Record<string, any> |
| Default | undefined |
emptyStateView
Custom component displayed when there are no notifications.| Type | React.ReactNode |
| Default | Built-in empty state with illustration |
errorStateView
Custom component displayed when an error occurs.| Type | React.ReactNode |
| Default | Built-in error state with retry button |
headerView
Custom component replacing the entire header.| Type | React.ReactNode |
| Default | Built-in header with title and mark-all-read button |
loadingStateView
Custom component displayed during the initial loading state.| Type | React.ReactNode |
| Default | Built-in loading spinner |
notificationCategoriesRequestBuilder
Custom request builder for fetching categories.| Type | CometChat.NotificationCategoriesRequestBuilder |
| Default | SDK default (50 per page) |
notificationFeedRequestBuilder
Custom request builder for fetching feed items.| Type | CometChat.NotificationFeedRequestBuilder |
| Default | SDK default (20 per page) |
onActionClick
Callback fired when an interactive element inside a card is clicked.| Type | (feedItem: NotificationFeedItem, action: CardAction) => void |
| Default | undefined |
CardAction object contains:
type— Action type (e.g.,"openUrl","chatWithUser")params— Action parameters (e.g.,{ url: "..." },{ uid: "..." })elementId— ID of the element that triggered the action
onBackPress
Callback fired when the back button is pressed.| Type | () => void |
| Default | undefined |
onError
Callback fired when the component encounters an error.| Type | (error: CometChat.CometChatException) => void |
| Default | undefined |
onItemClick
Callback fired when a feed item card is clicked.| Type | (feedItem: NotificationFeedItem) => void |
| Default | undefined |
scrollToItemId
Deep link to a specific feed item by ID. The component scrolls to the item once loaded.| Type | string |
| Default | undefined |
showBackButton
Shows/hides the back button in the header.| Type | boolean |
| Default | false |
showFilterChips
Shows/hides the category filter chips row.| Type | boolean |
| Default | true |
showHeader
Shows/hides the entire header.| Type | boolean |
| Default | true |
style
Style customization object.| Type | CometChatNotificationFeedStyle |
| Default | undefined |
title
Header title text.| Type | string |
| Default | "Notifications" |
Additional Exports
CometChatNotificationBadge
A standalone badge component that displays the unread notification count. Uses a shared polling singleton — multiple badges share one interval and listener.Props
| Prop | Type | Default | Description |
|---|---|---|---|
category | string | undefined | Filter count by category |
max | number | 99 | Maximum count before showing “N+“ |
style.backgroundColor | string | "#6852D6" | Badge background color |
style.textColor | string | "#fff" | Badge text color |
style.fontSize | string | "11px" | Badge font size |
style.borderRadius | string | "9999px" | Badge border radius |
useNotificationUnreadCount
A React hook for tracking unread notification count. Uses a shared singleton — multiple components share one polling interval and WebSocket listener.Return Value
| Field | Type | Description |
|---|---|---|
count | number | Current unread count |
refresh | () => Promise<void> | Manually refresh the count |
isLoading | boolean | Whether the initial fetch is in progress |
Options
| Option | Type | Default | Description |
|---|---|---|---|
category | string | undefined | Filter count by category |
pollingInterval | number | 30000 | Polling interval in milliseconds |
Common Patterns
Show only unread items
Hide filter chips and header
Deep link to a specific notification
Embed in a sidebar
Add notification badge to navigation
Next Steps
Campaigns Feature
Overview of how campaigns work end-to-end
SDK Campaigns API
Low-level SDK APIs for feed items, categories, and engagement
Theming
Customize colors, fonts, and appearance
Components
Browse all prebuilt UI components