Menus & navigation JS behaviour

Activity dropdown

A notification bell with an unread badge, relative times in the page’s language and a “mark all as read” that dims the dots at once.

Real scenarios

The component as it is used in a product — not a specimen grid.

Two inboxes, two moods

The left bell has 3 unread — the count rolls when it changes, times read as “3 minutes ago” in the page language, and the first row links to the roadmap. The right one has nothing left: the badge and its slot fade away.

Marking all read is a client-side dim plus a server ping — the count rolls down through NabuXUI::formatNumber’s Persian digits as well. 3 unread at first render.

Important props

Important props
Prop Type Default What it does
items array [] Each row: id, actor.name (+avatar), text, target, time (a date or a label), unread and href.
title / empty-text string «اعلان‌ها» The panel title and the empty state text (defaults to “all caught up”).
nx-mark-all-read event — Fired when “mark all as read” is pressed, so the server can persist it.

Snippet

<x-nx::activity-dropdown x-on:nx-mark-all-read="$wire.save('همه خوانده شد')" :items="[
    ['id' => 'a1', 'actor' => ['name' => 'آوا کریمی'], 'text' => 'در جریان گذاشت', 'target' => 'طرح سه‌ماهه',
     'time' => now()->subMinutes(4), 'unread' => true],
    ['id' => 'a2', 'actor' => ['name' => 'سهیل نوری'], 'text' => 'تأیید کرد', 'target' => 'خرید دامنه',
     'time' => now()->subDay()],
]" />