Base
JS behaviour
Dialog
A native <dialog> modal entangled with Livewire; type-to-confirm deletion, teammate invites and action footers.
Real scenarios
The component as it is used in a product — not a specimen grid.
Delete the workspace — prove you mean it
Backdrop clicks are off here; the red button stays inert until the name matches exactly. Esc still works.
The everyday one: invite a teammate
Title and description feed the dialog’s accessible names; the footer carries the quiet and the loud action.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| wire:model | bool | — | Open/close bound to a Livewire property — from both the server and the client. |
| title / description | string | null | The dialog head; aria-labelledby/describedby are wired automatically. |
| size | string | md | Dialog width: sm · md · lg · xl · full. |
| closeOnBackdrop | bool | true | Clicking the backdrop closes; turn it off for dangerous forms. |
| footer | slot | — | The closing slot for the button row. |
Snippet
<x-nx::button variant="danger" wire:click="$set('state.confirmOpen', true)">
حذف ورکاسپیس
</x-nx::button>
<x-nx::dialog wire:model="state.confirmOpen" title="حذف ورکاسپیس"
description="این کار برگشتپذیر نیست" size="sm" :close-on-backdrop="false">
<p>برای تایید، نام ورکاسپیس را بنویسید.</p>
<x-slot:footer>
<x-nx::button variant="ghost" wire:click="$set('state.confirmOpen', false)">انصراف</x-nx::button>
<x-nx::button variant="danger" wire:click="save('حذف شد')">حذف کن</x-nx::button>
</x-slot:footer>
</x-nx::dialog>