Recipes: Changelog and notifications
Two compositions of public Lumen components. Neither needs a dedicated component or extra CSS.
Install editable starters
pnpm exec lumen add notification-bell --target astro
pnpm exec lumen add changelog --target astropnpm exec lumen add notification-bell --target react
pnpm exec lumen add changelog --target reactpnpm exec lumen add notification-bell --target elements
pnpm exec lumen add changelog --target elementsThe starters include ready, loading, empty, and error views. Supply a stable instance id and application-owned snapshots. Notifications keep unread state until the host confirms an explicit mark-as-read request; opening the panel never changes it.
React exports NotificationBell and Changelog with onRead(id) and onRetry() callbacks. The notification starter includes a local NotificationBellDemo. Use pendingIds, readError, and a single announcement to reflect the save lifecycle.
Astro emits lumen:notification-read-request with an id, lumen:notification-retry-request, and lumen:changelog-retry-request. Elements uses the same events through renderNotificationBell(root, options) and renderChangelog(root, options). Handle requests in the host and render the confirmed next snapshot; no backend or persistence is installed.
Keep global styles and adapter runtime setup at the application entry. The following smaller examples explain the composition; the installed source adds the state and retry contracts.
Changelog list
Compose Timeline for the release order, a heading with a self-link for each version, FormattedDate for the machine-readable release date, and Badge for change kinds and the latest marker.
Version 6.0.0
Latest- Added Segmented Meter for seat and quota limits.
- Breaking Removed the deprecated glass Card variant.
- Fixed PhoneInput keeps the selected country when the list changes.
---
import { Badge, FormattedDate, Link, Stack, Timeline, TimelineItem, Typography } from '@santi020k/lumen-astro'
type ChangeKind = 'added' | 'breaking' | 'fixed'
interface Release {
date: string
notes: { kind: ChangeKind; text: string }[]
version: string
}
// Newest first. The first release gets the "Latest" marker.
const releases: Release[] = [
{
date: '2026-12-01',
notes: [
{ kind: 'added', text: 'Segmented Meter for seat and quota limits.' },
{ kind: 'breaking', text: 'Removed the deprecated glass Card variant.' }
],
version: '6.0.0'
},
{
date: '2026-10-14',
notes: [{ kind: 'fixed', text: 'PhoneInput keeps the selected country when the list changes.' }],
version: '5.4.1'
}
]
// Visible text for each kind; the Badge variant is decoration, so the word carries the meaning.
const kinds = {
added: { label: 'Added', variant: 'success' },
breaking: { label: 'Breaking', variant: 'destructive' },
fixed: { label: 'Fixed', variant: 'secondary' }
} as const
const dateFormatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long', timeZone: 'UTC' })
const anchor = (version: string) => `changelog-v${version.replaceAll('.', '-')}`
---
<Timeline aria-label="Release history">
{releases.map((release, index) => (
<TimelineItem aria-labelledby={anchor(release.version)}>
<Stack gap="sm">
<Stack align="center" direction="horizontal" gap="sm" wrap>
<h3 id={anchor(release.version)}>
<Link href={`#${anchor(release.version)}`}>Version {release.version}</Link>
</h3>
{index === 0 && <Badge variant="outline">Latest</Badge>}
</Stack>
<FormattedDate datetime={release.date}>{dateFormatter.format(new Date(`${release.date}T00:00:00Z`))}</FormattedDate>
<Typography>
<ul>
{release.notes.map(note => (
<li>
<Badge variant={kinds[note.kind].variant}>{kinds[note.kind].label}</Badge> {note.text}
</li>
))}
</ul>
</Typography>
</Stack>
</TimelineItem>
))}
</Timeline>- Give every version heading a stable id and link the heading to itself so readers can share a release.
- Badges carry visible words such as Added, Fixed, and Breaking. Color only repeats that meaning.
- Format the date on the server with a fixed time zone and keep the ISO date in
datetime. - Mark only the newest release as Latest, and keep releases newest first.
ChangeSummary is for reviewing before-and-after field values, not release notes, so this recipe leaves it out. A dedicated ReleaseList component would only replace a few lines of layout that Timeline and Stack already provide.
Notification bell
Compose Popover with a bell Icon, a FloatingBadge count, a list of notifications, and a See all link.
---
import {
Badge,
FloatingBadge,
FormattedDate,
Icon,
Link,
Popover,
PopoverPanel,
PopoverTrigger,
Stack,
VisuallyHidden
} from '@santi020k/lumen-astro'
interface Notification {
href: string
id: string
sentAt: string
title: string
unread: boolean
}
// The host owns notifications, read state, and the unread count.
const notifications: Notification[] = [
{
href: '#notification-invite',
id: 'invite',
sentAt: '2026-12-01T09:30:00Z',
title: 'Ana invited you to Billing',
unread: true
},
{
href: '#notification-deploy',
id: 'deploy',
sentAt: '2026-12-01T08:05:00Z',
title: 'Deploy 128 finished',
unread: true
},
{
href: '#notification-comment',
id: 'comment',
sentAt: '2026-11-30T16:45:00Z',
title: 'Luis replied to your comment',
unread: false
}
]
const unreadCount = notifications.filter(notification => notification.unread).length
// The button name carries the count; the badge only repeats it visually.
const triggerLabel = unreadCount === 0 ? 'Notifications' : `Notifications, ${unreadCount} unread`
const badgeText = unreadCount > 9 ? '9+' : String(unreadCount)
const timeFormatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'medium', timeStyle: 'short', timeZone: 'UTC' })
---
<Popover>
<PopoverTrigger aria-haspopup="dialog" aria-label={triggerLabel} style="position: relative;">
<Icon name="bell" decorative />
{unreadCount > 0 && (
<FloatingBadge aria-hidden="true" style="position: absolute; inset-block-start: -0.5rem; inset-inline-end: -0.5rem;">
{badgeText}
</FloatingBadge>
)}
</PopoverTrigger>
<PopoverPanel aria-labelledby="notification-bell-title" role="dialog" style="display: grid; gap: 0.75rem; min-width: 18rem;">
<h3 id="notification-bell-title">Notifications</h3>
<ul aria-labelledby="notification-bell-title" role="list" style="display: grid; gap: 0.75rem; list-style: none; margin: 0; padding: 0;">
{notifications.map(notification => (
<li>
<Stack gap="xs">
<Stack align="center" direction="horizontal" gap="xs" wrap>
<Link href={notification.href}>{notification.title}</Link>
{notification.unread && <Badge variant="default">Unread</Badge>}
</Stack>
<FormattedDate datetime={notification.sentAt}>{timeFormatter.format(new Date(notification.sentAt))}</FormattedDate>
</Stack>
</li>
))}
</ul>
<Link href="#notification-bell-all">See all notifications</Link>
</PopoverPanel>
</Popover>
<!-- Update this polite region when new notifications arrive; do not rename the button on every change. -->
<VisuallyHidden aria-live="polite" data-notification-bell-status></VisuallyHidden>- Put the unread count in the button name, such as “Notifications, 2 unread”, and hide the badge from screen readers so the count is read once.
- Cap the visible badge at “9+” but keep the exact count in the button name. Omit the badge while the count is unknown or zero.
- Set
aria-haspopup="dialog"and give the panelrole="dialog"with a heading. The panel holds links, not menu items. - Announce new arrivals once through a separate polite live region. Renaming the button on every update is not announced reliably and interrupts the reader.
- Show read and unread state as text, and mark items read with an explicit action. Opening the panel should not discard notifications.
For paging, empty history, and failed requests, follow the activity inbox guidance in the consumer UI recipes. Lumen does not ship a NotificationBell component because every part of it is application state around existing primitives.