Hide close button at the last tab

Hello,

I am trying to hide the close button on the last tab of my SfTab component but show it on other tabs.


I saw that you suggested a solution at this thread https://www.syncfusion.com/forums/136253/do-not-show-close-button-only-on-first-home-tab


Can you suggest a solution for a Blazor WebAssembly project?

Thanks in advance!


3 Replies 1 reply marked as answer

BS Balasubramanian Sattanathan Syncfusion Team February 22, 2022 07:43 PM UTC

Hi Amanda,


You can hide the close icon for the first Tab alone by using the below code snippet.


Code snippet:

<SfTab ID="SfTab" Height="320" ShowCloseButton="true">

    <TabItems>

        <TabItem Content="Content 1">

            <ChildContent>

                <TabHeader Text="Header 1"></TabHeader>

            </ChildContent>

        </TabItem>

        <TabItem Content="Content 2">

            <ChildContent>

                <TabHeader Text="Header 2"></TabHeader>

            </ChildContent>

        </TabItem>

        <TabItem Content="Content 3">

            <ChildContent>

                <TabHeader Text="Header 3"></TabHeader>

            </ChildContent>

        </TabItem>

    </TabItems>

</SfTab>

 

<style>

    #e-item-SfTab_0 .e-close-icon {

        display: none;

    }

</style>


Note: The solution will work in both server and WASM porject.

Kindly try the above solution and let us know if this is helpful.

Regards,

Balasubramanian S



AM Amanda February 28, 2022 05:43 PM UTC

Thank you for your quick response but could show me how to implement this at the last Tab?





VM Vengatesh Maniraj Syncfusion Team March 1, 2022 11:27 AM UTC

Please use the below CSS for the last tab. 
  
 
<style> 
 
    #e-item-SfTab_0 .e-close-icon { 
 
        display: none; 
 
    } 
 
    .e-toolbar-item:last-child .e-close-icon{ 
        display: none !important; 
    } 
 
</style> 
 


Marked as answer
Loader.
Up arrow icon