Skip to content
Alea
Pro
  1. Alea
  2. Components
  3. Feedback
  4. NotificationCenter

Feedback

NotificationCenter

A bell with an unread count that opens the list of notifications: mark one or all as read, dismiss, go to the action. A panel under the bell, or a drawer on small screens.

import { NotificationCenter } from '@alea-design/ui';

Examples

Notification bell

A bell with the unread count; it opens the list. Mark one or all as read, dismiss, or go to the action.

Four tones

Info, success, warning and danger set the icon and its color; screen readers hear the tone before the title.

Empty state

With nothing to show, the panel says so. Every text is a label you can change.

Controlled

You own the list. Every change comes back through onChange and per-action callbacks; new unread notifications are announced to screen readers.

Styles with per-group CSS

With the single stylesheet import, @alea-design/ui/styles.css, nothing more is needed. If you import the stylesheets by group instead, NotificationCenter is styled by its own group: import @alea-design/ui/css/notification.css next to base.css. Without it the panel renders unstyled and looks broken.

The panel also draws a Button, a Badge, an EmptyState and a Popover or Drawer, so the button, display, data and overlay groups must be imported too. dist/css/groups.json lists them under requires for the notification group, and lists the components each group styles.

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-accent…
  • --alea-accent-subtle…
  • --alea-border…
  • --alea-status-danger…
  • --alea-status-danger-bg…
  • --alea-status-info…
  • --alea-status-info-bg…
  • --alea-status-success…
  • --alea-status-success-bg…
  • --alea-status-warning…
  • --alea-status-warning-bg…
  • --alea-surface-hover…
  • --alea-text…
  • --alea-text-muted…
  • --alea-text-soft…

Space

  • --alea-space-1…
  • --alea-space-2…
  • --alea-space-3…
  • --alea-space-4…
  • --alea-space-6…
  • --alea-space-8…

Radius

  • --alea-radius-full…

Type

  • --alea-font-family-body…
  • --alea-font-size-md…
  • --alea-font-size-sm…
  • --alea-font-size-xs…
  • --alea-font-weight-medium…
  • --alea-font-weight-semibold…

Motion

  • --alea-motion-duration-base…
  • --alea-motion-ease-in…
  • --alea-motion-ease-out…

Component

  • --alea-focus-ring…

Props

NotificationCenter props

A bell with an unread count that opens the list of notifications: read one or all, dismiss, go to the action. A panel under the bell, or a drawer on small screens. You own the list; every change comes back through onChange. Arrow keys move between notifications, Escape closes and focus returns to the bell, and new unread notifications are announced.

PropTypeDefaultDescription
itemsrequiredNotificationItem[]The notifications, newest first. The component never changes them: it reports every change.
announcebooleantrueAnnounces new unread notifications to screen readers. Default true.
classNamestringnoneExtra class names for the root element.
defaultOpenbooleanfalseStarts open (uncontrolled).
isOpenbooleanfalseOpens or closes the panel (controlled).
labelsPartial<NotificationLabels>noneText overrides: the bell, the buttons, the empty state and the announcements.
maxnumber99The badge shows max+ above this. Default 99.
motionMotionPropnoneHow the panel enters and leaves: a preset, false for none, or options.
onAction((item: NotificationItem) => void)noneCalled when a notification's action is pressed.
onChange((items: NotificationItem[]) => void)noneCalled with the next list after any change (read, read all, dismiss).
onDismiss((item: NotificationItem) => void)noneCalled with the notification that was dismissed.
onMarkAllRead((items: NotificationItem[]) => void)noneCalled when "mark all as read" is pressed, with the notifications that were unread.
onMarkRead((item: NotificationItem) => void)noneCalled with the notification that was marked as read.
onOpenChange((isOpen: boolean) => void)noneCalled when the panel opens or closes.
placement"bottom end" | "bottom start" | "bottom" | "top" | "top start" | "top end""bottom end"Where the popover opens. Default bottom end.
presentation"auto" | "popover" | "drawer""auto"popover (a panel under the bell), drawer (a sheet from the bottom) or auto: a drawer on small screens. Default auto.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

Variants
placementbottom endbottom startbottomtoptop starttop end
presentationautopopoverdrawer
States
Keyboard focusHover (CSS)
Motion
Takes a motion prop for its entrance and exit.
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-notifs.alea-notifs-head.alea-notifs-title.alea-notifs-empty.alea-notifs-list.alea-notif-out.alea-notif.alea-notif-inner.alea-notif-icon.alea-notif-body.alea-notif-title.alea-notif-text
Data attributes
data-tone=successdata-tone=warningdata-tone=dangerdata-unread

Accessibility

  • The bell is named with the count: "Notifications, 3 unread". The badge itself is hidden from screen readers so the count is not read twice.
  • The panel is a dialog named by its title; Escape closes it and focus goes back to the bell.
  • Each notification is a list item that says whether it is unread and its tone before the title.
  • A new unread notification is announced politely, never on load and never for read ones.
  • Times are time elements with the exact date; the relative text follows the locale and refreshes while the panel is open.
  • Dismissing moves focus to the next notification, or to the empty state when it was the last one.

Keyboard

KeyDoes
Enter or SpaceOpens the panel from the bell
Up or Down arrowPrevious or next notification
Home or EndFirst or last notification
TabMoves through the buttons of the current notification, then to the next control
EscCloses the panel and returns to the bell

Do and don't

Do

  • Keep titles short and put the detail in the description.
  • Give every notification one action at most, and word it as a verb.
  • Keep the list in your own state and update it from onChange.

Don't

  • Don't use it for messages that need an answer right now: use Dialog or Alert.
  • Don't color a notification by importance only; the tone also sets the icon and the spoken word.

In Figma

The properties of the Figma components, generated from the kit, so they always match it. The last column is the React prop each one stands for.

Notification item · 8 variants

Figma propertyKindValuesDefaultReact prop
ToneVariantInfo, Success, Warning, DangerInfono React prop
StatusVariantUnread, ReadUnreadno React prop
TitleText-Deploy finishedno React prop
Description textText-The build is live on production.no React prop
TimeText-8 min agono React prop
Action labelText-Viewno React prop
DescriptionBoolean-trueno React prop
ActionBoolean-trueno React prop

Notification bell · 1 variants

Figma propertyKindValuesDefaultReact prop
BadgeBoolean-trueitems
OpenBoolean-falseisOpen, defaultOpen

Nested components exposed on it: Trigger, Badge

Notification center · 4 variants

Figma propertyKindValuesDefaultReact prop
PresentationVariantPopover, DrawerPopoverpresentation
ContentVariantList, EmptyListitems
Empty titleText-You are all caught uplabels
Empty descriptionText-New notifications will show up here.labels
Tested with axe, keyboard and screen reader roles