# Button

# Confirm

Quick usage for Confirm alert

Usage

<x-dashboard::button.confirm id="confirm123"
    :options="['title' => 'Are you sure you want to delete?']">
    Confirm button text
</x-dashboard::button.confirm>

@push('scripts')
    <script>
        const elem = document.getElementById('confirm123');

        // on confirm
        elem.addEventListener('confirmed', function(event) {
            console.log(event.detail)
        });

        // on cancel
        elem.addEventListener('cancelled', function(event) {
            console.log(event.detail)
        });
    </script>
@endpush

Customize

Copy confirm.blade.php (opens new window) to your dashboard theme under same structure /resources/views/components/button/confirm.blade.php

Available parameters

  1. id: Unique id to use later
  2. options: Options array will be used in Confirm alert