Notifications
Shown as Nightbell, a made-up product
A marina office's notification panel: mentions, berth requests and harbour alerts you act on in place, with Undo, filters, keyboard control and one update that arrives live.
Installation
pnpm dlx shadcn@latest add "https://propui.dev/r/nightbell-notifications.json?token=…"Adds the piece to components/propui/02-nightbell-notifications/ and installs motion. Needs a free account: sign in and the command includes your token. Fonts load from Prop UI; download the zip to self-host them.
When to use
Reach for it when
- A notification panel where people act on an update in place: confirm, decline, reply, message.
- An inbox of mixed updates (mentions, requests, alerts) that needs filters and an unread count.
- A panel that must work fully from the keyboard, with Undo for every change.
Something else fits when
- A single passing message: use a toast.
- A full activity history people search and page through: use a table or a feed page.
- Updates that never need an action: a plain list with a read state is lighter.
Usage
Fills a full window: give it a container with a definite height.
import Piece from "@/components/propui/02-nightbell-notifications/Section";
export default function Page() {
return (
<main className="h-dvh w-full overflow-hidden">
<Piece />
</main>
);
}Replace NOTES and ARRIVAL in data.ts with your updates and KINDS with your filters, and do the real work where run() and dismiss() update state in Section.tsx. Counts, groups and relative times are computed from the notes.
Your data
Replace these and everything on screen follows.
NOTESNote[]- Every update in the panel, in order within its group.
Note{ id; kind; group; ago; title: Run[]; detail; from; actions?; unread }- One row: who it is from, the title with emphasised runs, one line of detail, its time and actions.
Act{ id; label; done; primary?; reply? }- An inline action; done is the line that replaces the buttons, reply opens the composer.
KINDS{ id; label }[]- The filter tabs and their counts.
GROUPS{ id; label }[]- The group headings (Today, Earlier).
ARRIVALNote- The one update that arrives live, 4.2 seconds after load.
ago()(minutes) => string- Relative times against a fixed now, so server and browser render the same.
Interactions
- Filter by All, Mentions, Bookings or Harbour; each tab shows its count.
- Run an inline action (Confirm berth, Decline, Message skippers); the row says what happened and the footer offers Undo.
- Reply to a mention in an inline composer and send it.
- Hover or focus a row to swap its time for Mark read and Dismiss; dismissed rows slide out and the rest close up.
- Mark all read from the header, and undo it from the footer.
- Open settings to turn on the daily digest or pause for an hour.
- Clear every update in a filter to see the caught-up state.
Keyboard
- ↑or↓
- Move between updates.
- HomeorEnd
- Jump to the first or last update.
- Enter
- Open the reply for a mention, otherwise toggle read.
- DeleteorBackspace
- Dismiss the focused update.
- Esc
- Close the settings menu or the reply composer.
Behaviour
Read from the code: roles, motion, breakpoints and what runs.
Accessibility
- Filters are a tablist of tabs with aria-selected; the panel is a section labelled by its heading.
- The list uses a roving tab stop: one update and its buttons are in the tab order at a time, and the arrows move between them.
- The unread count has a label ("4 unread"), and the settings toggles are checkboxes with role switch.
- Confirmations and Undo appear in the footer, a polite live region, so they never cover an update.
- On touch screens, where there is no hover, Mark read and Dismiss are always shown.
Motion
- The unread count rolls up or down as it changes, and the tab underline slides between filters.
- Dismissed rows slide out to the right and the rows below close up; the live arrival tints its row for 2.6 seconds.
- The settings menu fades and scales in from its button.
- Reduced motion turns off the arrival tint and makes every change instant.
Responsive
- The panel is 440px wide and never wider than the screen; its height fits the window and the list scrolls inside it.
- Below 480px the padding tightens, and the filter tabs scroll sideways when they do not fit, with the chosen tab scrolled into view.
- Below 375px the check icon in Mark all read hides so the header stays on one line.
Performance
- Three timers in all: the live arrival once, the arrival tint, and the footer message that clears after about five seconds.
- No images or canvas: one local font file and inline SVG icons.
Notes for AI
Give your coding assistant the Markdown, not a screenshot.
- Keep updates in data.ts; derive counts, groups and times from NOTES rather than hard-coding them.
- Every action that changes state should pass an undo to say() so the footer can offer it.
- Light only. Keep colours in the tokens at the top of post.css.
/p/nightbell-notifications/markdownThe whole library for assistants: llms.txt, or the MCP server in AI tools and MCP.