File manager
A full file browser: folders open along the breadcrumb trail, the search filters the current folder, a file card slides its details drawer in, and uploads reach the app through nx-upload or wire:model — sizes and dates in the reader’s digits and calendar.
Real scenarios
The component as it is used in a product — not a specimen grid.
The shop’s media library
Click a folder card and the trail opens along the breadcrumbs; the search filters only the folder you are in (Persian and Arabic letter variants fold together — open «عکس محصول» and type «کفش»), a file card slides its details drawer in from the inline end — Escape or the scrim closes it — and the toolbar’s segmented flips grid to list. Sizes and dates arrive in the reader’s digits and calendar.
The legal archive, in list view
current opens the board already inside «قراردادها / ۱۴۰۴», so the breadcrumb trail is there from the first paint. Dates come straight from Carbon and the Intl calendar formats them (Jalali for Persian); entries with an href grow an Open button in the drawer, and every folder move reports through the nx-navigate event — the toast below rides it.
The project delivery room
The «Final cuts» folder is empty — its empty text arrives from outside, like the folder a client just got. The upload button opens the native picker: unwired, the nx-upload event hands you the FileList (the toast counts it); put a wire:model on the component instead and the very same picker binds to Livewire’s uploads.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| items | array | [] | Each entry: ['id' => …, 'name' => …, 'parent' => its folder (omitted = root), 'kind' => folder|image|audio|video|file (or let the extension say), 'size' => bytes, 'items' => folder count, 'modified' => Carbon|ISO|timestamp|label, 'href' => the drawer’s Open link, 'preview' => the drawer image, 'details' => [['label' => …, 'value' => …]]]; folders list first and names sort in the reader’s collation. |
| view / current | string | grid / null | view seeds the toolbar’s segmented (grid or list) and current is the folder the board opens in; the breadcrumb trail builds from it upward. Switching views is client-side and fires nx-view. |
| height / label | string | null | The scrollable stage height (30rem, say), riding --nx-fm-height, and the board’s accessible name; the root crumb wears the same word. |
| searchPlaceholder / emptyText | string | null | The search placeholder and the empty-folder text — defaults come from the core i18n table (fa/en/ar); the search folds Persian and Arabic letter variants alike. |
| wire:model | — | null | Sits on the component and lands on the native file picker so Livewire takes the uploads (with WithFileUploads); without it the nx-upload event bubbles with the FileList. Other events: nx-navigate (folder entered), nx-open (a file’s drawer) and nx-view. |
| locale | string | null | The locale for digits, dates and built-in words (defaults to the app’s); dates format through IntlDateFormatter, and the TRADITIONAL calendar means Jalali for Persian. |
Snippet
<x-nx::file-manager :items="[
['id' => 'design', 'name' => 'طراحی', 'kind' => 'folder', 'items' => 12],
['id' => 'logo.svg', 'name' => 'logo.svg', 'parent' => 'design', 'size' => 18432,
'modified' => now()->subDays(2), 'href' => '#',
'details' => [['label' => 'کاربرد', 'value' => 'سربرگ و فاکتور']]],
]" current="design" height="30rem" wire:model="uploads"
x-on:nx-navigate="$wire.visit($event.detail.folder)"
x-on:nx-upload="$wire.ingest($event.detail.files)" />
{{-- بدون اتصال لایووایر: نمای فهرستی با حالت خالی سفارشی --}}
<x-nx::file-manager view="list" label="اسناد" :items="$docs"
empty-text="هنوز سندی بارگذاری نشده" />