Raft Design System

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.

StableAlso called Notifications
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

SituationUse
A problem or a change that affects the whole serverNotificationCenter
Something happened elsewhere that the person should seeActivity (ActivityInbox)
Something in one panel failedPanelNotice under the panel header (Panel)
The result of an action the person tookToast

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) and NotificationCenterCount.
    • NotificationCenterScroller and NotificationCenterList: the notices.
    • NotificationCenterEmptyState: what the list says when it is empty (EmptyState).
  • NotificationCenterItem: one notice, in a NotificationCenterItemRow:
    • 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, NotificationCenterItemBody and NotificationCenterItemActions with NotificationCenterActionButtons.

Variants

VariantUse for
status="error" on the iconSomething stopped working: a computer offline, an agent that can't start. warning-soft tile, octagon-alert icon
status="warning"Something will stop working soon: a quota nearly full, a key about to expire. warning-soft tile, triangle-alert icon
status="info"News: an update. info-soft tile, info icon
viewport="mobile" on the popupThe popup on a phone: the screen's width less 8px on each side, kept 8px from the screen's edges
size on the popupThe popup's height: sm, md or lg

States

StateLook
Unread (default)The title in foreground at weight 700, and a pink attention dot on the right
readThe title in foreground-muted at weight 600; no dot

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). Pass collisionPadding to 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

  • NotificationCenter wraps the Base UI Popover, 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.
  • NotificationCenterItemIcon is an image (role="img") named by its status (Error, Warning, Info).

Rules

  • Make the actions in a notice ink-outline small buttons, never pink; NotificationCenterActionButton does this (InboxItem).
  • Use orange tiles for errors and warnings, not red (Color).

API

NotificationCenter

PropTypeDefault
actionsRefA ref to imperative actions. - `unmount`: Ends the closing phase of the popover after an externally controlled closing animation finishes. Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the popover completes closing on its own. Whether it leaves the DOM is decided by `keepMounted` on the portal. - `close`: Closes the popover imperatively when called.RefObject<PopoverRootActions | null>
childrenThe content of the popover. This can be a regular React node or a render function that receives the `payload` of the active trigger.ReactNode | PayloadChildRenderFunction<unknown>
defaultOpenWhether the popover is initially open.booleanfalse
defaultTriggerIdID of the trigger that the popover is associated with. This is useful in conjunction with the `defaultOpen` prop to create an initially open popover.string
handleA handle to associate the popover with a trigger. If specified, allows external triggers to control the popover's open state.BasePopover.Handle<unknown>
modalDetermines if the popover enters a modal state when open. - `true`: user interaction is limited to the popover: document page scroll is locked, and pointer interactions on outside elements are disabled. - `false`: user interaction with the rest of the document is allowed. - `'trap-focus'`: focus is trapped inside the popover, but document page scroll is not locked and pointer interactions outside of it remain enabled.boolean | "trap-focus"false
onOpenChangeEvent handler called when the popover is opened or closed.(open: boolean, eventDetails: BasePopover.Root.ChangeEventDetails) => void
onOpenChangeCompleteEvent handler called after any animations complete when the popover is opened or closed.(open: boolean) => void
openWhether the popover is currently open.boolean
triggerIdID of the trigger that the popover is associated with. This is useful in conjunction with the `open` prop to create a controlled popover. There's no need to specify this prop when the popover is uncontrolled (that is, when the `open` prop is not set).string

NotificationCenterActionButton

PropTypeDefault
loadingBusy: shows the spinner and blocks activation (click, Enter, Space and form submission) while keeping the button focusable. A busy button is `aria-disabled`, not natively `disabled`, so the focus a press left on it stays there and is still there when the wait ends.boolean
loadingLabelThe spinner's accessible name while `loading`: say what is happening.string
focusableWhenDisabledWhether the button should be focusable when disabled.booleanfalse
nativeButtonWhether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`).booleantrue
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

NotificationCenterCount, NotificationCenterEmptyState, NotificationCenterHeader

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

NotificationCenterItem

PropTypeDefault
readbooleanfalse
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

NotificationCenterItemActions, NotificationCenterItemBody, NotificationCenterItemContent

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

NotificationCenterItemIcon

PropTypeDefault
status"warning" | "success" | "error" | "info""info"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

NotificationCenterItemRow, NotificationCenterItemTitle, NotificationCenterList

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

NotificationCenterPopup

PropTypeDefault
portalPropsPopoverPortalProps
size"sm" | "md" | "lg""md"
viewport"desktop" | "mobile""desktop"
alignHow to align the popup relative to the specified side.Align"center"
alignOffsetAdditional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment.number | OffsetFunction0
anchorAn element to position the popup against. By default, the popup will be positioned against the trigger.Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null)
arrowPaddingMinimum distance to maintain between the arrow and the edges of the popup.number5
collisionAvoidanceDetermines how to handle collisions when positioning the popup.CollisionAvoidance
collisionBoundaryAn element or a rectangle that delimits the area that the popup is confined to.Boundary'clipping-ancestors'
collisionPaddingAdditional space to maintain from the edge of the collision boundary.Padding5
disableAnchorTrackingWhether to disable the popup from tracking any layout shift of its positioning anchor.booleanfalse
finalFocusDetermines the element to focus when the popover is closed.boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | boolean | HTMLElement | null)
initialFocusDetermines the element to focus when the popover is opened. By default, focus moves to the first tabbable element inside the popup, except when the popover is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard.boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => void | boolean | HTMLElement | null)false
positionMethodDetermines which CSS `position` property to use."fixed" | "absolute""fixed"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)
sideWhich side of the anchor element to align the popup against. May automatically change to avoid collisions.Side"bottom"
sideOffsetDistance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment.number | OffsetFunction4
stickyWhether to maintain the popup in the viewport after the anchor element was scrolled out of view.booleanfalse

Also takes the attributes of its element.

NotificationCenterScroller

The notices' scroller, a ScrollArea: `ref`, `className`, `render` and the native props are the scrolling element's.
PropTypeDefault
actionsRefMethods to scroll from code that the container doesn't have natively.((instance: ScrollAreaActions | null) => void | (() => void | { [UNDEFINED_VOID_ONLY]: never; }) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<ScrollAreaActions | null>
childrenThe scrolling content, in ScrollArea's own container.ReactNode
contentClassNameClass of a content element around `children`, inside the container: put padding and the content's own layout (grid, flex, `gap`, `stack-y-*`) here, so the scrollbars stay at the edges and the gutters layer is never one of the laid-out children. Only with it, `contentStyle` or `fade` is there one.string
contentRefAn element whose size is the content's, watched for size changes (such as a hidden mirror of a textarea's text). Without it each element child of the container is watched, and children added or removed.RefObject<HTMLElement | null>
contentStyleStyle of the content element; renders it, as `contentClassName` does.CSSProperties
fadeFade the content out toward an edge that has more past it. The scrollbars don't fade.boolean
hideDelayHow long the scrollbars stay after scrolling stops, in ms. At least 100 with `trigger="scroll"`.number
onEdgeChangeCalled when the area reaches or leaves an edge, and after mounting when the content overflows.(edges: ScrollAreaEdges) => void
onScrollThe container's scroll events.UIEventHandler<HTMLDivElement>
orientationThe directions the area scrolls in. Content too wide for a vertical area is cut off.ScrollAreaOrientation
overscrollWhat a scroll that reaches the end does: stop there with no bounce (`none`, the default), stop there but let Mac trackpads and iOS bounce the area (`contain`), or carry on to the page behind (`auto`, which leaves the container's own `overscroll-behavior` alone). Only in the directions the area overflows right now.ScrollAreaOverscroll
railInsetRoom in px the scrollbars keep clear at each end, such as a sticky header's height, so they don't run over it. Also settable in CSS, on the root: `--r-scroll-area-rail-inset-{top,bottom,left,right}`, which don't inherit.ScrollAreaRailInset
renderAnother element in place of ScrollArea's own `<div>`, as the container (an element or a function that gets the props). It must hold children: the gutters are its first child.ReactElement | ((props, state) => ReactElement)
sizeThumb thickness: `small` is 5px, `medium` 7px; both grow while pointed at or dragged.ScrollAreaSize"md"
tabIndexThe container's: by default `0` while there is something to scroll.number
triggerWhen the scrollbars show. They always show while scrolling or dragging.ScrollAreaTrigger

Also takes the attributes of its element.

NotificationCenterTitle

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

NotificationCenterTrigger

PropTypeDefault
closeDelayHow long to wait before closing the popover that was opened on hover. Specified in milliseconds.number0
delayHow long to wait before the popover may be opened on hover. Specified in milliseconds.number300
handleA handle to associate the trigger with a popover.BasePopover.Handle<unknown>
nativeButtonWhether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (e.g. `<div>`).booleantrue
openOnHoverWhether the popover should also open when the trigger is hovered.booleanfalse
payloadA payload to pass to the popover when it is opened.{}
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

Changes

  • 0.103.4 · FixedFrame insets (Popover, DropdownMenu, ContextMenu, Select, Combobox, ComboboxSelect, Tooltip, PreviewCard, CoachMark, NotificationCenter, MobileNavServerPopover, ToastPositioner, ComposerSuggestionList): --raft-frame-inset-start and --raft-frame-inset-end are 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 a calc() or env(titlebar-area-*) expression on an overlay title bar.
  • 0.103.0 · Breaking ChangesExplanation slots take only a HelperText: FieldDescription, FormSection's description, a ChoiceList item's description, SelectItemDescription, DialogDescription, AlertDialogDescription, DrawerDescription, PopoverDescription, EmptyStateDescription, CardDescription, CardFooter, BannerDescription, DialogFooterNote (work in progress), MessageActionCardHint, MessageActionCardHeaderDescription, MessageActionCardScopeDescription and MessageActionCardActionsNote. A HelperText is made only by helperText(content, { why, about }): content is any ReactNode (a string, a formatted message, a TextLink inside a sentence), why is "consequence", "audience" or "recovery", and about names the thing the line is about. Each slot renders the content with data-why and data-about, and in development warns once when it is given anything else, which it still renders. ToastDescription, NotificationCenterItemBody, EmptyStateTitle, ListRowDescription and 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, MessageActionCardScopeListViewport and DialogNav show 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 · FixedEmptyStateIcon is hidden from assistive technology, and NotificationCenterItemIcon is announced as an image named by its status.
  • 0.6.0 · Breaking ChangesProps that no longer change anything are removed: Badge uppercase; Checkbox size, variant, color; Status pulse, attention (status never animates); Switch / SwitchThumb size; SidebarItem variant; SidebarItemCount / SidebarItemIndicator variant and appearance (the count is always the pink sticker, the indicator the yellow @); NotificationCenterActionButton variant; DrawerContent width (one-go forms use the wide Dialog); AppRailItemIndicator attention; AppRailItemAttention children; Steps size, track, renderIndicator, renderTraveler; FilePreviewBadge type, color. Remove them at call sites.