Data JS behaviour

Mail

A three-pane mail client: the folder rail, the message list and a reading pane with a reply composer — opening a message also marks it read, stars and tallies stay live, and dates and digits follow the page’s locale; replies leave through the nx-reply event or a Livewire method.

Real scenarios

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

The support inbox

The six built-in folders with unread tallies in the page’s digits; opening a message folds its unread bar away, the star works from both the list and the reading pane, and the arrow keys (Home and End too) walk the rows. Send a reply — Enter sends, Shift+Enter breaks a line — and the nx-reply event reports back through a toast.

Demo walkthrough at 10 tomorrow?

From سارا رضایی · sara@nabu.ai

Hi;

Does 10 o'clock still work for the walkthrough?

I'll bring the Persian-digits report with me.

The December invoices are ready for review

From عمر حداد · omar@nabu.ai

Hello;

All 214 invoices of December are exported.

Two of them want a second look at their VAT.

[nabuxui] PR #421 merged

From GitHub · notifications@github.com

kenji-sato merged 3 commits into main.

2 checks passed.

Contract signed

From مریم رضایی To سارا رضایی

Sent from the legal desk — the countersigned copy is yours.

One-time password

From بانک ملت · no-reply@bmi.ir

Your code is 4821 — never share it.

Select a message to read it

Reply to سارا رضایی

The “starred” folder is virtual — it gathers the starred of every folder. Without reply-action everything stays in the browser and nx-folder / nx-open / nx-star / nx-reply bubble for you to handle.

The shop’s correspondence desk

The built-ins step aside for the shop’s own folders — orders, billing, shipping, contracts — with icons from the same core set. Replies now ride reply-action: the composer clears and $wire.save(text, messageId) is called — this demo’s slow action (0.9s), which toasts the reply text back.

When does order 1248 arrive?

From لیلا حداد · leila@shop.example

Hi;

The order was placed on Tuesday — any news yet?

The customer is asking again.

Transaction 9812 settled

From Payment gateway · billing@nabu.shop

The amount reaches your account within two working days.

Parcel 1248 handed to the courier

From Central warehouse

It left the Tabriz hub at 6:40.

Reseller agreement, version 2

From Kenji Sato · kenji@example.com

Two clauses changed; the redlines are attached.

Select a message to read it

Reply to لیلا حداد

The open message, server-side

The virtual starred folder opens the scene, and the message being read rides wire:model.live back to the server (the root exposes x-modelable="open") — exactly what a server-side unread counter would need.

Evening-shift handover notes

From آمارا اوکافور

Three conversations stay open;

9812 is still waiting for billing.

Feedback on the Arabic tone

From نیلوفر احمدی

The formal register reads better now; keep it.

Weekly report

From ایجنت نابو

412 conversations, 96% answered within the hour.

Select a message to read it

Reply to آمارا اوکافور

On the server (wire:model.live): null — it stays null until you open a message.

Important props

Important props
Prop Type Default What it does
messages array [] Each message: ['id' => …, 'from' => ['name' => …, 'email' => …, 'avatar' => …], 'to' => …, 'subject' => …, 'body' => … (one paragraph per line, the first line previews the row), 'time' => Carbon|timestamp|ISO|label, 'unread' => bool, 'starred' => bool, 'folder' => …].
folders array شش پوشهٔ داخلی Defaults to inbox · starred · sent · drafts · archive · trash (“starred” is virtual — it gathers every folder’s starred); a list of ['id' => …, 'label' => …, 'icon' => …] replaces them, each one’s badge counting the same messages.
open / folder string null The open message’s id (the folder’s first by default) and the starting folder; open also binds through wire:model on the root (x-modelable), so the server knows which message is being read.
replyAction string null A Livewire method name; once a reply is sent the composer clears and $wire.action(text, messageId) fires. Without it the nx-folder / nx-open / nx-star / nx-reply events bubble on the element itself.
height string 36rem The whole frame’s height (riding --nx-email-height).
placeholder / emptyText / labels / locale string / string / array / string null / null / [] / null The composer placeholder, the empty-folder text, overrides for the built-in words, and the dates-and-digits locale (the app’s by default); the keys come from the core i18n table (fa/en/ar).

Snippet

<x-nx::email :messages="[
    ['id' => 'm1', 'from' => ['name' => 'سارا رضایی', 'email' => 'sara@nabu.ai'],
        'subject' => 'جلسهٔ دمو ساعت ۱۰ فردا؟', 'body' => "سلام؛\nهمان ساعت ۱۰ می‌ماند؟",
        'time' => now()->subMinutes(18), 'unread' => true, 'starred' => true],
    ['id' => 'm2', 'from' => ['name' => 'GitHub'], 'subject' => '[nabuxui] PR merged',
        'body' => 'PR #421 merged into main.', 'folder' => 'archive'],
]" open="m1" height="34rem"
    x-on:nx-reply="$wire.ping('پاسخ فرستاده شد')" />

{{-- پوشه‌های خودتان + پاسخ به متد لایووایر --}}
<x-nx::email :messages="$deskMail" :folders="[
    ['id' => 'orders', 'label' => 'سفارش‌ها', 'icon' => 'file'],
    ['id' => 'billing', 'label' => 'مالی', 'icon' => 'chart'],
]" folder="orders" reply-action="sendReply" height="30rem" />

{{-- پیامِ باز روی سرور: wire:model روی ریشه (x-modelable) --}}
<x-nx::email :messages="$messages" wire:model.live="openMail" />