Components · Inbox
NotificationCenter
The list that opens from the bell and holds the state of the whole server — a computer offline, a quota nearly full, an update — until it changes.
import { NotificationCenter } from "@botiverse/raft-ui";The NotificationCenter is the list that opens from the bell. It holds the state of the whole server (a computer offline, a quota nearly full, an update) and keeps each notice until the situation changes. An attention dot on the bell says that something is unread.
When to use
Errors by scope are in Feedback. Where a product puts the bell is on the product's own page.
Anatomy
NotificationCenter: the root. A non-modal popover.NotificationCenterTrigger: the bell. By default it draws the bell and the attention dot.NotificationCenterPopup: the list's popup, next to the bell.NotificationCenterHeader:NotificationCenterTitle(Notifications) andNotificationCenterCount.NotificationCenterScrollerandNotificationCenterList: the notices.NotificationCenterEmptyState: what the list says when it is empty (EmptyState).
NotificationCenterItem: one notice, in aNotificationCenterItemRow:NotificationCenterItemIcon: a tile with an icon. A notice from the system has no who, so a tile stands where an avatar would (InboxItem).NotificationCenterItemContent:NotificationCenterItemTitle,NotificationCenterItemBodyandNotificationCenterItemActionswithNotificationCenterActionButtons.
Variants
States
Behavior
- Sort notices by severity: errors first, then warnings, then information.
- When the person dismisses a notice, don't show it again until the situation changes.
- Show the attention dot on the bell only while a notice is unread. The default trigger always draws the dot, so pass the bell alone as the trigger's children when nothing is unread.
- Float the popup next to the bell; it doesn't take space in the layout (Elevation).
- On a phone (
viewport="mobile"), the popup is 8px from each screen edge, the same as the server list under the same top bar: it is as wide as the positioner's--available-width(the screen less both 8px paddings), at most 480px, which only a phone on its side reaches, and its collision padding is 8px, so it sits 8px from both edges although it hangs from a bell at the right (Elevation). PasscollisionPaddingto change it. On desktop it is 380px with Base UI's default collision padding. - Where a shell keeps part of the window for itself (
--raft-frame-inset-top,--raft-frame-inset-start,--raft-frame-inset-end), the popup keeps its 8px from that part, not from the screen's edge, and is narrower by it. The start and end insets are the corners of the top band, so they count only when the bell is in the band (Page structure). The web sets none.
Content
- Write the notice in the same order as an inbox item: where (the computer, the server), then what happened, then at most 2 lines of detail (InboxItem).
Accessibility
NotificationCenterwraps the Base UIPopover, non-modal by default; the popup doesn't take focus when it opens.- The popup is named "Notification center" and the list "Notifications" unless you pass another
aria-label. - Give the trigger an accessible name, and include the unread state:
aria-label="Notifications, 2 unread". The bell and the dot are hidden from assistive technology. NotificationCenterItemIconis an image (role="img") named by its status (Error, Warning, Info).
Rules
API
NotificationCenter
NotificationCenterActionButton
Also takes the attributes of its element.
NotificationCenterCount, NotificationCenterEmptyState, NotificationCenterHeader
Also takes the attributes of its element.
NotificationCenterItem
Also takes the attributes of its element.
NotificationCenterItemActions, NotificationCenterItemBody, NotificationCenterItemContent
Also takes the attributes of its element.
NotificationCenterItemIcon
Also takes the attributes of its element.
NotificationCenterItemRow, NotificationCenterItemTitle, NotificationCenterList
Also takes the attributes of its element.
NotificationCenterPopup
Also takes the attributes of its element.
NotificationCenterScroller
Also takes the attributes of its element.
NotificationCenterTitle
Also takes the attributes of its element.
NotificationCenterTrigger
Also takes the attributes of its element.
Related
Changes
- 0.103.4 · FixedFrame insets (
Popover,DropdownMenu,ContextMenu,Select,Combobox,ComboboxSelect,Tooltip,PreviewCard,CoachMark,NotificationCenter,MobileNavServerPopover,ToastPositioner,ComposerSuggestionList):--raft-frame-inset-startand--raft-frame-inset-endare the corners of the window's top band (--raft-frame-inset-top), not columns down its sides. A popup anchored under the band keeps its own padding from the window's edge; only one anchored in the band (a title-bar control, or a context menu opened in the bar) keeps 8px clear of a corner. - 0.103.3 · FixedFrame insets (
useFrameInsets,frameCollisionBoundary): opening a positioned popup (Popover,DropdownMenu,Select,Combobox,ComboboxSelect,ContextMenu,Tooltip,PreviewCard,NotificationCenter,MobileNavServerPopover,ComposerSuggestionList) no longer stalls the main thread when--raft-frame-inset-*holds acalc()orenv(titlebar-area-*)expression on an overlay title bar. - 0.103.0 · Breaking ChangesExplanation slots take only a
HelperText:FieldDescription,FormSection'sdescription, aChoiceListitem'sdescription,SelectItemDescription,DialogDescription,AlertDialogDescription,DrawerDescription,PopoverDescription,EmptyStateDescription,CardDescription,CardFooter,BannerDescription,DialogFooterNote(work in progress),MessageActionCardHint,MessageActionCardHeaderDescription,MessageActionCardScopeDescriptionandMessageActionCardActionsNote. AHelperTextis made only byhelperText(content, { why, about }):contentis anyReactNode(a string, a formatted message, aTextLinkinside a sentence),whyis"consequence","audience"or"recovery", andaboutnames the thing the line is about. Each slot renders the content withdata-whyanddata-about, and in development warns once when it is given anything else, which it still renders.ToastDescription,NotificationCenterItemBody,EmptyStateTitle,ListRowDescriptionand the status and data parts are unchanged. - 0.73.0 · ChangedEvery region that scrolls is a ScrollArea:
PanelScrollViewport,ActivityInboxViewport,SearchShellViewport,NotificationCenterScroller,FilesViewport,TasksPanelViewport, ChoiceList's scroller,MobileNavServerPopoverList,ComposerSuggestionList,AnnouncementDialogBody,MessageActionCardScopeListViewportandDialogNavshow ScrollArea's overlay scrollbar instead of the platform's. Native scrolling stays only in the places scroll-area.md lists, each with its reason, and a test fails on any other. - 0.7.0 · Fixed
EmptyStateIconis hidden from assistive technology, andNotificationCenterItemIconis announced as an image named by its status. - 0.6.0 · Breaking ChangesProps that no longer change anything are removed:
Badgeuppercase;Checkboxsize,variant,color;Statuspulse,attention(status never animates);Switch/SwitchThumbsize;SidebarItemvariant;SidebarItemCount/SidebarItemIndicatorvariantandappearance(the count is always the pink sticker, the indicator the yellow @);NotificationCenterActionButtonvariant;DrawerContentwidth(one-go forms use the wideDialog);AppRailItemIndicatorattention;AppRailItemAttentionchildren;Stepssize,track,renderIndicator,renderTraveler;FilePreviewBadgetype,color. Remove them at call sites.