Skip to main content
Urbicon UI
source

NotificationCenter

Menu-ready notification list with mark-as-read, delete, and empty state. Renders each notification as a clickable card with timestamp.

01 Usage

Basic

Notifications

<script lang="ts">
  import { NotificationCenter } from '@urbicon-ui/auth';

  const demoNotifications = [
    {
      id: '1',
      userId: 'demo',
      title: 'Welcome!',
      body: 'Your account has been created.',
      type: 'system',
      typeKey: 'welcome',
      url: null,
      icon: null,
      createdAt: new Date(Date.now() - 5 * 60000),
      readAt: null
    },
    {
      id: '2',
      userId: 'demo',
      title: 'New feature available',
      body: 'Passkey login is now supported.',
      type: 'system',
      typeKey: 'feature',
      url: null,
      icon: null,
      createdAt: new Date(Date.now() - 3600000),
      readAt: new Date()
    }
  ];
</script>

<NotificationCenter
  notifications={demoNotifications}
  onMarkAsRead={(id) => console.log('Mark as read:', id)}
  onMarkAllAsRead={() => console.log('Mark all as read')}
  onDelete={(id) => console.log('Delete:', id)}
/>

02 Accessibility

Each notification is a button, not a clickable row

The body of every item is a real <button> rather than a click handler on the <li>. That is what makes it reachable with Tab and activatable with Enter or Space without any extra ARIA — a div with an onclick would have needed a role, a tabindex and a key handler to reach the same place.

Unread state does not reach assistive tech

The unread dot is correctly aria-hidden="true" — it is decoration. But nothing replaces it: the read/unread distinction exists only as that dot, a background tint, and a data-unread attribute for CSS. A screen-reader user cannot currently tell a read notification from an unread one. Use the item snippet if your application needs that distinction spoken.

The delete button is icon-only and generically named

It renders a × glyph, so an aria-label is mandatory and present — but it is the bare localized "Delete", without the notification's title. Compare PasskeyManager and InvitationManager, which append the row's subject; in a list of ten notifications this one gives ten identically named buttons.

The list is a list; the timestamp is not yet a timestamp

Items sit in a real <ul>, so the count is announced before the contents. The relative age uses a <time> element but supplies no datetime attribute, and its text ("2 hours ago") is not a valid datetime string — so the element carries no machine-readable date and gives assistive tech nothing the plain text would not. Treat it as styling, not semantics.

03 API Reference

10 props 1 required
Prop
Type
Default
Description

04 Types

Local type definitions used by this component.

4 types
Name
Kind
Category
Used by
Description

05 Installation

Import

import { NotificationCenter } from '@urbicon-ui/auth';