Show Toasts always on top of all

Hi, I'm using ToastService acording to your documents to show toasts in the blazor wasm app. 
The problem I have is that if I want to show a toast while a full-width dialog is open, since the ToastService toasts target #body, the toasts end up under the open dialog, as you can see in the screenshot of the corner the dialog.


Considering the fact that I the toasts can be triggered to show from different parts of the app and we have not much control over where to target, could you think of a solution for how to show the toasts always on top of all the other components? 
I tried a higher z-index for the toasts but they still show under. 


3 Replies

BS Buvana Sathasivam Syncfusion Team June 27, 2023 05:21 PM UTC

Hi CageE,


Greetings from Syncfusion support.


By default, the SfDialog component has a higher z-index than other elements. To display the SfToast in front of the SfDialog, you need to make a few adjustments. Firstly, specify a static ZIndex value on the SfDialog component. This will ensure that it doesn't overlap with the SfToast. Additionally, set a higher z-index on the SfToast component compared to the SfDialog's ZIndex.


To assist you further, we have prepared a code snippet and sample for your reference:


Index.razor

<SfDialog @ref="DialogRef" ZIndex="1000000">……..

</SfDialog>


ToastComponent.razor

<style>

    .e-toast {

        z-index: 1000001;

    }

</style>




Regards,

Buvana S


Attachment: BlazorApp_6ae019f7.zip


SG Sven G November 8, 2023 04:29 PM UTC

You could also set the z-index of the toast container


    .e-toast-container {

        z-index: 1040;

    }



Perhaps could you please remove the hardcoded style in the e-toast-conta



MR Mallesh Ravi Chandran Syncfusion Team November 14, 2023 06:25 PM UTC

Hi Sven G , 

Thank you for providing this information. Certainly, you have the option to eliminate the hardcoded style in the e-toast. When establishing the z-index for the dialog, there's no necessity to explicitly set the z-index for the toast component. It's worth noting that the z-index for the toast is inherently configured to be higher than that of the dialog.


Regards, 

Mallesh


Loader.
Up arrow icon