Data JS behaviour

Workspace shell

A workspace shell: a sidebar with live items, a header, a footer and a prompt slot; href items are links, the rest are buttons that make themselves current.

Real scenarios

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

Nabu Desk, as a customer sees it

Sidebar items without href are buttons that make themselves current — the id rides a live Livewire property, so the badge and the header answer from the server. The prompt slot holds a prompt of our own.

Inbox Live
Olá! Has order #4821 shipped? Beatriz · WhatsApp
How do I rotate my API key? Sam · Web
¿Tienen factura en euros? Carmen · Telegram
返品の手続きを教えてください Haruto · LINE
هل يمكنني تغيير خطتي؟ Omar · WhatsApp
Rechnung für September? Lena · E-mail

Important props

Important props
Prop Type Default What it does
items array [] Each item: ['id' => …, 'label' => …, 'icon' => …, 'badge' => 12], optionally 'href' + 'navigate' => true.
active / wire:model string null The current item’s id; wire:model on the component binds it (x-modelable).
brand / brandMark / label string null The brand name, its mark and the bar’s accessible label.
height / collapsed / promptPlaceholder string / bool / string null The shell height, starting collapsed, and the built-in prompt’s placeholder (until you pass slot:prompt).
slot:header / footer / prompt slot — The page header, the sidebar’s foot and the page-bottom prompt — the page itself is the default slot.

Snippet

<x-nx::workspace-shell brand="میز نابو" :active="$state['view'] ?? 'inbox'" wire:model.live="state.view" :items="$items">
    <x-slot:header><strong>صندوق ورودی</strong></x-slot:header>
    … صفحه …
    <x-slot:footer>… کاربر جاری …</x-slot:footer>
    <x-slot:prompt><x-nx::prompt wire:submit="ask" /></x-slot:prompt>
</x-nx::workspace-shell>