Guides
Navigation
Feedback
Overlays
Layout
Data Display
Forms
.md

Overlays

dialog

Modal dialog with focus trap, backdrop, and Esc-to-close.

Are you sure?

This action cannot be undone.

This will permanently delete the project and all of its data.

Installation

php artisan ui:add dialog

Usage

<x-ui.dialog title="Are you sure?" description="This action cannot be undone.">
    <x-slot:trigger>
        <x-ui.button variant="outline">Open dialog</x-ui.button>
    </x-slot:trigger>

    <p class="text-sm text-muted-foreground">Dialog body content.</p>

    <x-slot:footer>
        <x-ui.button variant="outline"
            data-ui-dialog-close>Cancel</x-ui.button>
        <x-ui.button variant="destructive">Delete</x-ui.button>
    </x-slot:footer>
</x-ui.dialog>

Built on the native <dialog> element (top layer, focus trap, Esc to close) plus a small inline <script>; no JS dependencies. The `trigger` slot opens the dialog; an optional `footer` slot renders action buttons.

Props

Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.

@props([
    'title' => null,
    'description' => null,
])