Laravel: delete button with double-click confirmation

August 13, 2020 ≈ 22 seconds

Every time, I need to delete something, a confirmation question pops up. The universal widely used approach is to use confirmation dialog (browser default or custom). An alternative is to use double-click confirmation. Below, code of blade component I use in my projects.

<form action="{{ $action }}" method="post">

    <button class="focus:outline-none"
            onclick="if ( === 'brightness(75%)') this.parentElement.submit(); else = 'brightness(75%)'"



@component('backend.components.delete_button', [
    'action' => '/route/to/action'

Subscribe to our newsletter

If you provide url of your website, we send you free design concept of one element (by our choice)

Subscribing to our newsletter, you comply with subscription terms and Privacy Policy