Display a success or failure modal or alert?

How do I display a modal after running a query or API successfully ? Currently I am seeing the modal comes with a button to trigger it . But in my case I don't want to display the button . Need to display only the modal after API success.

Hi @dheeraj, happy to help! You can do this by adding an event handler to your query, which will trigger the modal to open on success (see first screenshot). On the modal component itself, you can add hidden={{!modal.opened}} which will hide the button whenever the modal is not open.

Hope this helps! Let me know if you have any questions :slightly_smiling_face:

1 Like

Is there a way to bring the modal to the center of the screen and disable the components behind the modal?

Hey @sbhat, check out this answer from the forum!

@minijohn thank you for linking this! @dheeraj as shown in the linked post, you will likely need to add the custom css properties to both grey out the background as well as center the modal. Here is a post on how to achieve custom CSS!