Styling the Inbox component
Learn how to style the pre built Inbox component
The Novu Inbox component is designed to be fully themeable and adaptable to your application’s visual language. All theming options are exposed through the appearance
prop, which allows you to apply custom styles at different levels of control from predefined themes to component-level overrides.
The appearance prop supports the following keys:
baseTheme
: Apply a predefined theme (for example, light or dark).variables
: Define global styling properties (for example, colors, fonts).elements
: Style individual UI components.icons
: Replace default icons with custom ones.
Understand style injection
When rendered, the Inbox component automatically injects its styles into the <head>
of the HTML document. If the component is rendered inside a shadow DOM, styles are scoped and injected into the shadow root instead.
This ensures that:
- Styles remain encapsulated and do not leak into global stylesheets
- No additional setup is required to manage scoped styling
Apply base theme
You can apply a predefined visual style to the entire Inbox UI by passing the baseTheme
object inside the appearance
prop. This is a quick way to implement a dark mode or any base look and feel without redefining every variable.
Novu currently provides a built-in dark theme, which you can import from @novu/react/themes
.
Define global variables
You can override the default styles in the Inbox component by passing a variables
object inside the appearance
prop. This is an efficient way to apply broad visual changes with minimal configuration.
baseTheme
and variables
are provided, variables always take precedence over the base theme.List of available variables
Prop | Type | Default |
---|---|---|
borderRadius? | string | - |
fontSize? | string | - |
colorShadow? | string | - |
colorNeutral? | string | - |
colorCounterForeground? | string | - |
colorCounter? | string | - |
colorSecondaryForeground? | string | - |
colorSecondary? | string | - |
colorPrimaryForeground? | string | - |
colorPrimary? | string | - |
colorForeground? | string | - |
colorBackground? | string | - |
Style the Inbox UI elements
You can define styles for individual UI components within the Inbox UI by passing the elements
object inside the appearance prop. Each key corresponds to a specific component, and the value can be either a style object or a set of CSS classes.
Here's a list of some available elements that can be styled using the elements object in your appearance configuration:
Element | Key in appearance.elements |
---|---|
Primary action button | notificationPrimaryAction__button |
Secondary action button | notificationSecondaryAction__button |
Notification container | notification |
Subject text | notificationSubject |
Body text | notificationBody |
Notification icon/image | notificationImage |
Preferences button | preferences__button |
Date display | notificationDate |
Archive button | notificationArchive__button |
Snooze button | notificationSnooze__button |
Unread/read indicator button | notificationUnread__button |
Notification list container | notificationList |
Any selector that appears before the 🔔 emoji in the Devtools, can be targeted via the elements property in the appearance prop (stripping the nv-
prefix). You can also use TS autocomplete to find the available elements.
Using style object
You can pass inline styles to individual elements using the elements
object in the appearance
prop. Each element accepts a style object.
Using Tailwind CSS
You can pass Tailwind CSS classes to specific elements using the elements object within the appearance prop.
Using CSS modules
You can style the Inbox components using CSS Modules. First, define the styles in a .module.css
file:
Then, import the CSS module into your component and apply the classes using the elements
object in the appearance
prop:
Styling notifications by severity
Notification severity comes with default visual styles, but you can fully customize how notifications look for each severity level using the appearance
prop.
variables
and elements
objects to apply custom styling.
Customizing severity colors
You can override the default severity colors by setting new CSS custom properties in the appearance.variables
object. Updating these variables automatically changes both the notification color and the bell icon color.
Prop | Description |
---|---|
colorSeverityHigh | Color for high severity |
colorSeverityMedium | Color for medium severity |
colorSeverityLow | Color for low severity |
Customizing severity elements
You can apply specific styles to individual components using keys in the appearance.elements
object. This lets you target components conditionally based on their severity state.
This table lists severity element keys:
Elements key | Description |
---|---|
severityHigh__bellContainer | Styles the bell container for high severity |
severityMedium__bellContainer | Styles the bell container for medium severity |
severityLow__bellContainer | Styles the bell container for low severity |
bellSeverityGlow | Base style for the severity glow around the bell |
severityGlowHigh__bellSeverityGlow | Glow style for high severity |
severityGlowMedium__bellSeverityGlow | Glow style for medium severity |
severityGlowLow__bellSeverityGlow | Glow style for low severity |
severityHigh__notification | Styles individual high severity notifications |
severityMedium__notification | Styles individual medium severity notifications |
severityLow__notification | Styles individual low severity notifications |
notificationBar | Base style for the vertical notification bar on the left of a notification |
severityHigh__notificationBar | Styles the notification bar for high severity |
severityMedium__notificationBar | Styles the notification bar for medium severity |
severityLow__notificationBar | Styles the notification bar for low severity |