Prerequisites
Before using the AppSloth Inbox component, make sure you’ve:- Set up AppSloth in your project
- Installed the required shadcn/ui components:
Adding the Inbox Component
The AppSloth Inbox component provides a customizable notification center for your application. It includes features like real-time notifications, tabbed interface for new and archived notifications, search functionality, and customizable styling. Adding the Inbox component to your application is straightforward:Position your Inbox component where it’s easily accessible to users. Common
placements include the navigation bar or header area, typically aligned to the
right side.
How It Works
The Inbox component provides a comprehensive notification system:- Real-time Updates: Automatically polls for new notifications
- Tabbed Interface: Separate tabs for new and archived notifications
- Search Functionality: Search through archived notifications
- Unread Badges: Visual indicator for unread notifications
- Customizable UI: Extensive styling and configuration options
- Timestamp Display: Configurable timestamp formatting
Customization Options
The Inbox component is highly customizable through props:Button and Badge Customization
Customize the trigger button and unread badge:Tab Customization
Customize the tabs for new and archived notifications:Search and Empty States
Configure search behavior and empty state messages:Custom Notification Rendering
Provide custom rendering for notification items:Component Props
| Prop | Type | Default | Description |
|---|---|---|---|
triggerButton | ButtonConfig | { icon: <Bell />, variant: "ghost", size: "icon" } | Configuration for the trigger button |
unreadBadge | BadgeConfig | { variant: "destructive", position: { top: "-1px", right: "-1px" } } | Configuration for the unread count badge |
newTab | TabConfig | { label: "New" } | Configuration for the new notifications tab |
archiveTab | TabConfig | { label: "Archive" } | Configuration for the archived notifications tab |
menuWidth | number | 400 | Width of the dropdown menu in pixels |
maxHeight | number | 400 | Maximum height of the notification list |
showSearch | boolean | true | Whether to show the search input in archive |
searchPlaceholder | string | ”Search archived notifications…” | Placeholder text for search input |
markAllAsReadText | string | ”Mark all as read” | Text for the mark all as read button |
emptyNewMessage | string | ”No new notifications” | Message shown when no new notifications |
emptyArchivedMessage | string | ”No archived notifications” | Message shown when no archived notifications |
emptySearchMessage | string | ”No matching notifications” | Message shown when search has no results |
pollingInterval | number | 60000 | Interval for checking new notifications (ms) |
notificationItemClassName | string | "" | Additional classes for notification items |
showTimestamps | boolean | true | Whether to show timestamps |
timestampFormat | "relative" | "absolute" | ”relative” | Format for displaying timestamps |
renderNotificationItem | (notification: Notification) => React.ReactNode | undefined | Custom renderer for notifications |
onNotificationClick | (notification: Notification) => void | undefined | Callback when notification is clicked |
dropdownClassName | string | "" | Additional classes for dropdown content |
Viewing Notifications in the Dashboard
All notifications can be managed and analyzed in your AppSloth Dashboard:- Log into your AppSloth Dashboard
- Navigate to the “Notifications” section
- Manage your notifications:
- Create new notifications
- View delivery statistics
- Analyze engagement metrics
- Configure notification rules
