Guides
Navigation
Feedback
Overlays
Layout
Data Display
Forms
.md

Overlays

alert-dialog

Modal that interrupts the user and waits for a deliberate response.

Delete this project?

This removes the project and everything in it. It cannot be undone.

Installation

php artisan ui:add alert-dialog

Usage

<x-ui.alert-dialog title="Delete this project?"
    description="This cannot be undone.">
    <x-slot:trigger>
        <x-ui.button variant="destructive">Delete project</x-ui.button>
    </x-slot:trigger>

    {{-- Anything marked data-ui-alert-dialog-close dismisses it; the overlay
         deliberately does not. --}}
    <x-slot:footer>
        <x-ui.button variant="outline" data-ui-alert-dialog-close>Cancel</x-ui.button>
        <x-ui.button variant="destructive" data-ui-alert-dialog-close>Delete</x-ui.button>
    </x-slot:footer>
</x-ui.alert-dialog>

Native dialog element plus its own inline <script>; no JS dependencies. Unlike dialog there is no close button and the overlay is inert. Put dismiss buttons in the `footer` slot and mark them data-ui-alert-dialog-close.

Props

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

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