# Alert

Based on sweetalert (opens new window)

# Confirm

Show confirm message. For better usage see Confirm button

Usage

<x-dashboard::alert.confirm id="confirmUniqueId"
    :options="['title' => 'Are you sure']">
    <x-dashboard-button id="confirmUniqueId">
        {!! $slot !!}
    </x-dashboard-button>
</x-dashboard::alert.confirm>

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

        // 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/alert/confirm.blade.php

Available parameters

  1. id: Unique id to use later
  2. options: You can pass all sweetalert configuration (opens new window)