Skip to main content

React Notification Center API Reference

This page contains complete documentation about the React Notification Center package. You can find here the list of all the components, hooks, and props that you can use.

Components

Components are the building blocks of the React Notification Center package. They are used to build the UI of the notification center.

NovuProvider

The NovuProvider is the root component of the React Notification Center package. It is used to wrap the components code and provide the notifications feed context to all its children. It’s responsible for establishing the notification center session, managing the web socket connection, and fetching the notifications feed.

Props interface

Store interface

I18NLanguage interface

Styles interface

To use the Styles Interface, you need to identify the property you need to modify to achieve your desired look and pass it as an object in the styles prop.
As listed in the Styles Interface, the notification center is made up of a number of components which can each be individually customized.
You can also check out our docs on customizing styles to see how to define styles for various components that make up the notification center.

Let’s take an example to see this in action:

By default, this is how the notification center looks:

Default UI of the notification center

Say, you wanted the text color to match the accent color. You just need to go over to the docs on customizing styles and find out which property needs to be modified. In our case, we need to change the color property as evident here:

We need to update the 'color' property

Now, that we know which property needs to change, all we need to do is pass an object to the styles prop while maintaining the nesting of object keys:
This gives us the desired result:

We need to update the 'color' property

Please have a look at our docs on customizing styles to see how to define styles for various components of the notification center.

Fetching strategy interface

PopoverNotificationCenter

The floating popover component that appears when clicking on the NotificationBell button. It renders the NotificationCenter component inside its content.

Props interface

More information about the IMessage interface, and the theme interface.

The tab interface

The list item interface

NotificationCenter

The component that renders the notifications feed and allows to update the user preferences.

Props interface

NotificationBell

The component that renders the notification bell with the unseen notifications count.

Props interface

Hooks

useNotifications

This hook that allows you to get the notifications feed data and unseen notifications count. The notifications are fetched only when the fetchingStrategy.fetchNotifications is set to true interface, check the initialFetchingStrategy prop on the NovuProvider component.
useNotifications hook return interface
Description of the useNotifications hook return interface properties

useFetchNotifications

useFetchNotifications can fetche the notifications for a particular feed. It’s a thin version of the useNotifications hook and is based on the useInfiniteQuery hook from the react-query library. Notifications can be filtered using payload property. Check all properties of IStoreQuery interface. The notifications are fetched only when the fetchingStrategy.fetchNotifications is set to true interface, check the initialFetchingStrategy prop on the NovuProvider component.
useFetchNotifications hook return args
useFetchNotifications hook return interface

useUnseenCount

useUnseenCount returns the total unseen notifications count. Under the hood it uses the socket connection to get the unseen count updates.
useUnseenCount hook args interface
useUnseenCount hook return interface

useSocket

useSocket hooks is used to get the reference to socket object.
useSocket return interface
useSocket supported events

useNovuContext

useNovuContext hook is used to get the reference to the NovuProvider context.
useNovuContext hook return interface

useFeedUnseenCount

useFeedUnseenCount hook fetches the unseen count for a particular feed.
useFeedUnseenCount hook args interface
useFeedUnseenCount hook return interface

useFetchOrganization

useFetchOrganization hok fetches the current organization information.
useFetchOrganization hook args interface
useFetchOrganization hook return interface

useFetchUserPreferences

useFetchUserPreferences hook fetches the user preferences.
useFetchUserPreferences hook args interface
useFetchUserPreferences hook return interface

useUpdateUserPreferences

useUpdateUserPreferences hook is used to update the user preferences.
useUpdateUserPreferences hook args interface
useUpdateUserPreferences hook return interface

useUpdateAction

useUpdateAction hook can be used to update the notification action button status.
useUpdateAction hook args interface
useUpdateAction hook return interface

useMarkNotificationsAs

useMarkNotificationsAs hook that marks the notifications as read or seen.
useMarkNotificationsAs hook args interface
useMarkNotificationsAs hook return interface

useRemoveNotification

useRemoveNotification hook allows you to remove a message. It will delete the message for the subscriber and will refetch the feed.
useRemoveNotification hook args interface
useRemoveNotification hook return interface

useRemoveNotifications

This hook is available from version 0.23.1
useRemoveNotifications hook allows you to remove multiple messages with a limit of 100 messageIds in single call.
useRemoveNotifications hook args interface
useRemoveNotifications hook return interface

useRemoveAllNotifications

useRemoveAllNotifications hook allows you to remove all messages of all feeds. feedId can be used as param to delete only specific feed’s messages.
useRemoveAllNotifications hook args interface
useRemoveAllNotifications hook return interface

useTranslations

useTranslations hook allows you to get the reference to the translations object.
useTranslations returns interface

useNovuTheme

useNovuTheme hook can be used to get the reference to the theme object.
useNovuTheme hook return interface

The theme interface

IThemeLayout

IThemeHeader

IThemePopover

IThemeNotificationListItem

IThemeActionsMenu

IThemeUserPreferences

IThemeFooter

customization properties

ISvgStopColor

Others

The notification IMessage model

IMessage model has the following properties:

SubscriberProps

IMessageButton

ChannelCTATypeEnum

ChannelTypeEnum

ButtonTypeEnum