Notification list
The rows of a notification centre, grouped under "Today" and "Earlier", with an unread dot, a Mark as read button and room for inline actions. Put it in a popover or a drawer behind a bell button.

Needs Alpine and the package's script for Mark as read and Dismiss. See getting started. Everything else is plain Blade: each row is a link, and its actions are your own buttons.
Use it
<x-ds::popover label="Notifications" width="lg" placement="bottom-end">
<x-slot:trigger>
<x-ds::button variant="ghost" icon="bell" iconOnly :badge="$unread ?: null"
:aria-label="$unread ? 'Notifications, '.$unread.' unread' : 'Notifications'" />
</x-slot:trigger>
<x-ds::notification-list :unread="$unread" footerHref="/notifications" class="-m-4">
<x-slot:actions>
<x-ds::button variant="ghost" size="sm" wire:click="markAllRead">Mark all as read</x-ds::button>
</x-slot:actions>
<x-ds::notification-group label="Today">
@foreach ($today as $n)
<x-ds::notification-item :id="$n->id" :title="$n->title" :href="$n->url" :time="$n->created_at"
:unread="! $n->read_at" icon="chat-bubble-left" wire:key="n-{{ $n->id }}">
{{ $n->body }}
</x-ds::notification-item>
@endforeach
</x-ds::notification-group>
<x-ds::notification-group label="Earlier">…</x-ds::notification-group>
</x-ds::notification-list>
</x-ds::popover>
Items can sit straight in the list too, without groups. An empty list shows an empty state.
Props: notification-list
| Prop | Type | Default | What it does |
|---|---|---|---|
title | string | Notifications | The heading, and the region's name. |
unread | int | — | A count beside the heading. |
emptyTitle | string | You are all caught up | Shown when there are no items. |
emptyDescription | string | — | |
footerHref | string | — | A link under the list. The footer slot takes markup instead. |
footerLabel | string | View all notifications |
Slots: actions (in the header: "Mark all as read", settings), the default
slot (items, or groups), footer.
Props: notification-group
| Prop | Type | Default | What it does |
|---|---|---|---|
label | string | required | The group's heading: "Today", "Earlier". |
Props: notification-item
| Prop | Type | Default | What it does |
|---|---|---|---|
title | string | required | |
id | string or int | — | Sent back with read and dismiss. |
time | date, ISO 8601 string, or words | — | A date is shown relative ("3 hours ago") with the full date as its title. |
datetime | string | — | The machine time, when time is words. |
unread | bool | false | A dot, "Unread:" for screen readers, and a Mark as read button. |
href | string | — | The whole row goes here. |
icon | string | bell | An icon in a tinted circle, when there is no avatar slot. |
tone | neutral accent success warning danger | neutral | The circle's tint. |
dismissible | bool | false | A ✕ that dispatches dismiss. |
readLabel | string | Mark as read | |
dismissLabel | string | Dismiss | |
unreadLabel | string | Unread |
Slots: the default slot (the body), avatar (an avatar in place
of the icon), actions (inline buttons: Accept, Decline).
Events
The row's own buttons dispatch, bubbling, from the button:
| Event | When | detail |
|---|---|---|
read | Mark as read | { id } |
dismiss | ✕ | { id } |
The list draws nothing itself: you save the change and re-render. With Livewire:
<div x-on:read="$wire.markRead($event.detail.id)" x-on:dismiss="$wire.dismiss($event.detail.id)">
<x-ds::notification-list>…</x-ds::notification-list>
</div>
New notifications arrive the same way: wire:poll, or a broadcast event
that re-renders the component. The package fetches nothing.
Accessibility
- A region named by its heading, an
h2; each group's label is anh3over its own list. - A row with
hrefis one link, its title, stretched across the row by a pseudo-element so a press anywhere on the row follows it. The actions and the row's buttons sit above that layer, outside the link: nothing interactive is nested in it. The row draws the link's focus ring. - Unread is a dot and words: the link's name starts "Unread:". Mark as read and Dismiss are named with the row's title ("Mark as read: Maya commented").
Don't
- Don't make the whole row a button. It is a link to the thing; the actions are separate.
- Don't announce every new notification. A count on the bell, and the list when opened, is enough; a live region per row reads the whole list.
- Don't put more than two actions on a row. Past that, link to the thing.
More in specs/notification-list.md.
From the package repo: edit this page on GitHub.