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.
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.
Prop
Type
Description
backendUrl
string (optional)
The custom backend URL, your own deployed instance of the API. The default is https://api.novu.co.app/.
socketUrl
string (optional)
The custom socket URL, your own deployed instance of the WS app. The default is https://ws.novu.co/.
applicationIdentifier
string
The app id is taken from the Novu Settings -> API Keys tab.
The fetching strategy. By default notifications feed and user preferences are not fetched until the notification center is opened. You might need to tweak this configuration when building a custom UI and if you need to fetch notifications right away. Also it’s possible to change it when some action happens using the useNovuContext hook and setFetchingStrategy prop.
children
object
The ReactNode object type, the “consumer” of the NovuProvider context.
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.
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:
The floating popover component that appears when clicking on the NotificationBell button. It renders the NotificationCenter component inside its content.
Prop
Type
Description
position
string (optional)
Position of the popover relative to the bell icon. It is based on the Mantine Popover. The default is set to bottom-end.
The theme object allowing you to override light and dark colors of the UI components. Deprecated for styling, please use the styles prop on the NovuProvider.
Allows to define separate UI tabs for the notifications feed. The array of connection objects between the feed tab and stores (that you define on the NovuProvider) and feed identifier.
The render function allowing you to define the custom element for the notification list item.
showUserPreferences
boolean (optional)
The flag that enables to show/hide the user preferences. By default it is enabled.
allowedNotificationActions
boolean (optional)
The flag that enables to show/hide the dots menu for actions performed on a notification. By default it is enabled.
onUrlChange
function (optional)
The function that is called when the notification item has a CTA of type redirect and is clicked.
onNotificationClick
function (optional)
The function that is called when the notification item is clicked.
onUnseenCountChanged
function (optional)
The function that is called when the unseen notifications count changed.
children
function
The render function that allows you to define the custom bell button. It’s called with an argument that has unseenCount prop the number of unseen notifications.
header
function (optional)
The render function that allows you to define the custom header component.
footer
function (optional)
The render function that allows you to define the custom footer component.
emptyState
JSX.Element (optional)
The render function that allows you to define the custom component for the empty notifications list state.
onActionClick
function (optional)
The callback function triggered when the notification button is clicked.
actionsResultBlock
function (optional)
The render function that allows you to define the custom component that will be rendered after the notification button is clicked.
onTabClick
function (optional)
The callback function triggered when the notifications feed tab changes.
preferenceFilter
function (optional)
The callback function triggered when filtering the subscriber preference.
The theme object allowing you to override light and dark colors of the UI components. Deprecated for styling, please use the styles prop on the NovuProvider.
Allows to define separate UI tabs for the notifications feed. The array of connection objects between the feed tab and stores (that you define on the NovuProvider) and feed identifier.
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.
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.