Calm motion: animations on this site only fade, with no movement
NotificationInbox
Bell with a badge and a list of notices
A bell with a count, and a panel of notices that stay until the person reads or dismisses them. Use it for things that happen while someone is away: a reply, a finished build, an invite. For a message that reacts to an action and goes away by itself, use Toaster.
Basic
Notifications
- “Flat is fine.”2 min ago
- Unread: Build passed1 h ago
- Yesterday
- Monday
- You own the list.
itemsare{ id, title, body?, time?, read?, href? }, andtimeis text that you formatted ("2 min ago"). The inbox does not store anything. It reports what the person did, and you update the list. - Events:
read(id)when an unread notice is opened,readAll,dismiss(id), andselect(notice)for every open. A notice withhrefis a link, and it goes through your router when one is set. - The badge counts the unread items, up to
max("99+"). The bell is named from the count, for example "Notifications, 2 unread". Replace the name withlabels.bell. - An unread notice is bold and has an ink square. It also has the word "Unread" for screen readers, so the state is not only a style. The square is ink, not accent, because unread is not a choice.
- Mark all as read waits until there is an unread notice. An empty list shows "You are all caught up."
- The panel is a Popover: it dismisses with Esc or a click outside, and it puts focus back on the bell.
v-model:openandplacementwork as on Popover. labelsreplaces the English words:title,bell(n),readAll,dismiss,empty,unread.
Usage
ts
import { BlessNotificationInbox } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
items* | BlessNotice[] | — | |
placement | Placement | "bottom-end" | |
max | number | 99 | the largest count the badge shows before "99+" |
labels | Partial<{ title: string; bell: (unread: number) => string; readAll: string; dismiss: string; empty: string; unread: string; }> | — | |
open | boolean | false |
Events
| Name | Payload | Description |
|---|---|---|
update:open | [value: boolean] | |
select | [notice: BlessNotice] | |
dismiss | [id: string] | |
read | [id: string] | |
readAll | [] |