Notification Inbox
Notifications as a split layout. The list fills the space until you click one, then the notification opens beside it with who sent it, where it came from and what to do next. On a narrow screen it slides over the list.
Installation#
Usage#
The inbox owns the layout and which notification is open. The data stays yours: filter the rows you render for a search or a tab, mark a notification read in onValueChange, and the pager follows whatever rows are on screen.
The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.
Have a license? Unlock it here
Anatomy#
import {
NotificationInbox,
NotificationInboxList,
NotificationInboxBar,
NotificationInboxScroll,
NotificationInboxGroup,
NotificationInboxItem,
NotificationInboxItemMedia,
NotificationInboxItemContent,
NotificationInboxItemTitle,
NotificationInboxItemDescription,
NotificationInboxItemMeta,
NotificationInboxDetail,
NotificationInboxClose,
NotificationInboxPager,
NotificationInboxContent,
NotificationInboxFields,
NotificationInboxTitle,
NotificationInboxBody,
NotificationInboxActions,
} from "@/components/ui/notification-inbox"
<NotificationInbox>
<NotificationInboxList>
<NotificationInboxBar />
<NotificationInboxScroll>
<NotificationInboxGroup>
<NotificationInboxItem>
<NotificationInboxItemMedia />
<NotificationInboxItemContent>
<NotificationInboxItemTitle />
<NotificationInboxItemDescription />
</NotificationInboxItemContent>
<NotificationInboxItemMeta />
</NotificationInboxItem>
</NotificationInboxGroup>
</NotificationInboxScroll>
</NotificationInboxList>
<NotificationInboxDetail>
<NotificationInboxBar>
<NotificationInboxClose />
<NotificationInboxPager />
</NotificationInboxBar>
<NotificationInboxContent>
<NotificationInboxFields />
<NotificationInboxTitle />
<NotificationInboxBody />
<NotificationInboxActions />
</NotificationInboxContent>
</NotificationInboxDetail>
</NotificationInbox>In a dialog#
Open it from the bell in the top bar. Strip the dialog’s padding so the inbox runs edge to edge, keep the title above it, and give the dialog a height. On a phone the dialog becomes a sheet and the inbox switches to one side at a time.
API reference#
NotificationInbox
The split and the state its two sides share: which notification is open. Nothing is open until a row is clicked, and the list takes the full width. It is its own container: from 40rem wide the detail opens as a pane beside the list and the list narrows to listWidth, below that the detail slides over the list. Give it a height. Forwards native <div> props.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | null | - | Controlled. The open notification's value. |
| defaultValue | string | null | null | Initial open notification when uncontrolled. |
| onValueChange | (value: string | null) => void | - | Called when a row, the pager or the back button changes the open notification. Mark it read here. |
| listWidth | string | "22rem" | Width the list narrows to while a notification is open beside it. |
| Data attribute | Description |
|---|---|
| data-open | Present while a notification is open. |
NotificationInboxList
The list column, a labelled region. Hidden below 40rem while the detail covers it. Forwards native <div> props.
| Prop | Type | Default | Description |
|---|---|---|---|
| aria-label | string | "Notifications" | Names the region. |
NotificationInboxBar
A 48px bar with a hairline under it, for the search and filter row on the list side and the actions on the detail side. Both sides use the same bar, so their hairlines meet. Forwards native <div> props.
NotificationInboxScroll
The scrolling area under the bars. Forwards native <div> props.
NotificationInboxGroup
A run of rows under a day or a section label. It is a single-select listbox: arrow keys move between rows, the open one is selected. Forwards native <div> props.
| Prop | Type | Default | Description |
|---|---|---|---|
| label | ReactNode | - | The heading above the rows, and the listbox's name. |
NotificationInboxItem
One row. Opens its notification on click and moves focus to the detail when the detail covers the list. Forwards native <button> props.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Required. Identifies the notification. |
| unread | boolean | false | Medium-weight title, a dot under the time and an "Unread" prefix for screen readers. |
NotificationInboxItemMedia
The leading avatar or icon. Put the type glyph in an AvatarBadge.
NotificationInboxItemContent
The column for the title and the description.
NotificationInboxItemTitle
One line, truncated.
NotificationInboxItemDescription
One line by default; lines takes 1, 2, 3 or "none".
NotificationInboxItemMeta
The time, with the unread dot under it when the row is unread.
NotificationInboxDetail
The detail side, a labelled section, hidden until a notification is open. From 40rem it grows in from the right as the list narrows, below that it slides in over the list. Keep the last notification's content in it while it closes. Forwards native <section> props.
| Prop | Type | Default | Description |
|---|---|---|---|
| aria-label | string | "Notification" | Names the section. |
| Data attribute | Description |
|---|---|
| data-state | open or closed. |
NotificationInboxClose
Closes the detail and returns focus to its row. A cross at the end of the bar when the detail sits beside the list, a back arrow at the start when it covers the list.
NotificationInboxPager
"2 of 6" and previous and next buttons, in the order the rows are on screen right now, so a search or a tab narrows it too. Renders nothing when the open notification is not in the list.
NotificationInboxContent
The scrolling body of the detail.
NotificationInboxFields
A DescriptionList laid out as wrapping columns, term over value: From, Folder, Received, Type. Fill it with DescriptionListItem, DescriptionTerm and DescriptionDetails.
NotificationInboxTitle
The notification's heading, an <h2>.
NotificationInboxBody
The message, at reading measure.
NotificationInboxActions
A row for what to do next, usually one primary button.