Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shahmanish877's avatar

How to show modal on custom action?

I have created a custom action on view page of the post page which on click sends data to API for processing data and returns result in few second. User only sees loading animation near the action button, but I want to create a modal/popup which shows a custom loading animation and also disables the click on any of the links. I tried ->hint() which renders custom HTML in form, but it didn't work on the action, is there something like that on the action?

0 likes
3 replies
mohammadrasoulasghari's avatar

Hey there! 👋 I understand what you’re trying to achieve.

Loading states can be tricky, but I’ve got a solution that should work perfectly for you!

You can create a custom modal with an overlay using JavaScript and CSS. I’ll help you set it up step by step. Just let me know if you need the actual code snippets, and I’ll be happy to share them with you. Remember, we can always try different approaches if this one doesn’t quite fit your needs!

mohammadrasoulasghari's avatar

html :

<!-- Modal Structure -->
<div id="loadingModal" class="modal">
    <div class="modal-content">
        <div class="loader"></div>
        <p>Please wait ....</p>
    </div>
</div>
<div id="overlay"></div>

<!-- Your Action Button -->
<button onclick="handleAction()" class="action-button">Action</button>

JavaScript

css:

shahmanish877's avatar

Thank you @mohammadrasoulasghari For now, I have implemented JS solution, but I was wondering if there was some in-built functions from Filament.

Anyway, instead of creating custom action button and adding JS, I have used dispatch event.

Please or to participate in this conversation.