Skip to content

List and detail

Screens that pair a list with a reading pane: notifications, a list with detail and a record drawer.

Installation & usage

npx @youj/cli add app-notification-inbox

Also installs app-page, avatar, badge, button, card, empty, field, icon-archive, icon-at-sign, icon-bell, icon-check-check, icon-credit-card, icon-engine, icon-inbox, icon-mail, icon-mail-open, icon-message, icon-rocket, icon-shield-alert, illustrations, notification-center, presence-list, skeleton, switch, tabs, toggle, tooltip, use-announcer, use-now, youj-core, youj-presets, youj-ui-core.

The CLI copies the block to blocks/app/notification-inbox.tsx with every component it uses, so it’s yours to edit.

Every prop is optional and falls back to the demo, so it renders as you see it until you pass your own. Give it your data, rewrite or translate its strings through copy, and connect its actions:

notificationInbox-view.tsx
'use client'

import { NotificationInbox, type NotificationInboxProps } from '@/blocks/app/notification-inbox'

export function NotificationInboxView({ notifications, incoming, preferences, systemKinds }: Pick<NotificationInboxProps, 'notifications' | 'incoming' | 'preferences' | 'systemKinds'>) {
  return (
    <NotificationInbox
      notifications={notifications}
      incoming={incoming}
      preferences={preferences}
      systemKinds={systemKinds}
      copy={{ brand: 'Northwind' }}
      onPreferencesChange={(preferences, quiet) => {
        // your code
      }}
      onOpen={(notification) => {
        // your code
      }}
    />
  )
}

Reference

Props13 props

Props

NotificationInbox props
PropType
themeThemeInput

Wraps the page in this theme. Default: the theme around it.

–
embeddedboolean

A page in your app's frame: the shared page header (AppPage) and the frame's gutter, across the whole width, with no top bar of its own.

default true

true
copyPartial<NotificationsCopy>

Any of the page's strings, to rewrite or translate.

–
notificationsInboxNotification[]

The notifications it opens with. Default: a demo workspace's, timed from when the page opens.

–
incomingArrival[]

Notifications that arrive while the page is open, after ms from when it opens. Pass [] for none.

default two demo arrivals

two demo arrivals
preferencesPreferences

Where each kind reaches you, to start with.

default demo

demo
systemKindsreadonly Kind[]

The kinds the System tab lists.

default deploy, billing and security

deploy, billing and security
lockedChannelsPartial<Record<Kind, readonly Channel[]>>

Channels a kind always uses, whatever the switches say; those kinds also ignore Do not disturb.

default security's email

security's email
kindIconsRecord<string, ComponentType<IconProps>>

The icon for each kind, on its notification and in the bell.

default the five built-in kinds'; any other kind gets a bell

the five built-in kinds'; any other kind gets a bell
onPreferencesChange(preferences: Preferences, quiet: boolean) => void

Fires with every change to the switches.

–
onOpen(notification: InboxNotification) => void

Opening a notification (it's marked read too).

–
illustrationIllustrationSlot

The picture for an empty inbox: a scene by id, or your own node; null for none. Default: the notifications scene.

–
localestring

Formats its times (BCP 47). Default: copy.locale, else the app's locale (YoujProvider), else en-US.

–
Strings45 keys for copy

Strings

copy takes any of these keys; the rest keep their defaults. A key whose text holds a value (a count, a name) takes a function.

brandaccounttitlesubtitleinboxunreadCountloadingfiltersallmentionssystemunreadOnlymarkAllReadmarkReadmarkUnreadarchiveopenunreadPrefixtodayearlierjustNowannounceReadannounceUnreadannounceArchivedannounceAllReademptyTitleemptyDescriptionnoUnreadTitlenoUnreadDescriptionshowAllnoMentionsTitlenoMentionsDescriptionnoSystemTitlenoSystemDescriptionpreferencespreferencesDescriptionkindchannelskindschannelForrequiredquietquietDescriptionsavedHintlocale
Built from15 components
Accessibilitylandmarks, listbox, keyboard

Accessibility

Notifications has one h1, tabs for its filters, a live region for new items and a preferences table with a labelled switch per channel. List and detail moves through requests with Arrow Up and Down, Home, End and Enter, reorders with Alt plus the arrow keys, reports loading and errors in status and alert regions, and closes its phone drawer with Escape. Record drawer opens a sheet that traps focus and closes with Escape. Links and buttons are real a and button elements with the kit’s focus ring.