A bell with a count when something is unread and, under it, a panel with the notifications
(<.notification_center>).
<.notification_center
id="notifications"
items={@notifications}
on_read="read"
on_read_all="read_all"
/>
<.notification_center id="inbox" variant="classic" items={@notifications}
tabs={[%{id: "all", label: "All"}, %{id: "unread", label: "Unread"}, %{id: "orders", label: "Orders"}]}
all_href={~p"/notifications"} />Each item is a map: title (required), body, at, group (day heading shared by consecutive
items), type (info success warning error primary), tone (lime...), icon, avatar
(%{initials: "FP", tint: "t2"}), category (a tab id), read, id, and navigate, patch or href.
The panel is a popover (LedgerUI.Float hook, priv/static/ledger_ui/hooks/float.js): it closes on a click
outside and on Esc, opens with LedgerUI.open(socket, id) and the tabs filter in the browser. Marking as
read is up to the server: change read and the dot, the count and the bell follow. on_read
pushes %{"id" => id, "item" => item_id}, on_read_all %{"id" => id}, on_change the tab
%{"id" => id, "tab" => tab_id}; each takes an event name (to target) or a %JS{}.
variant="canvas" is the compact panel (rows only); classic has a title bar, tabs and footer.
inline renders only the panel, in the page flow (no bell, no hook).
Summary
Functions
Attributes
id(:string) (required)items(:list) - Defaults to[].tabs(:list) - Defaults to[%{id: "all", label: "Todas"}, %{id: "unread", label: "Não lidas"}].unread(:integer) - Defaults tonil.title(:string) - Defaults to"Notificações".bell_label(:string) - Defaults to"Notificações".read_all_label(:string) - Defaults to"Marcar todas como lidas".preferences_label(:string) - Defaults to"Preferências de notificação".all_label(:string) - Defaults to"Ver todas as notificações".unread_label(:string) - Defaults to"não lidas".empty(:string) - Defaults to"Nenhuma notificação".empty_text(:string) - Defaults to"Quando houver novidades, elas aparecem aqui.".variant(:string) - Defaults to"canvas". Must be one of"canvas", or"classic".empty_icon(:string) - Defaults tonil.empty_tone(:string) - Defaults to"success". Must be one of"neutral","primary","info","success","warning", or"error".all_href(:string) - Defaults tonil.preferences_href(:string) - Defaults tonil.on_read_all(:any) - Defaults tonil.on_read(:any) - Defaults tonil.on_change(:any) - Defaults tonil.target(:any) - Defaults tonil.open(:boolean) - Defaults tofalse.placement(:string) - Defaults to"bottom-end".arrow(:boolean) - Defaults tofalse.class(:any) - Merged into the panel. Defaults tonil.inline(:boolean) - Only the panel, in the page flow: no bell, no hook. Defaults tofalse.- Global attributes are accepted.
Slots
empty_action