Any way to allow some tab to be closable and not others

I'm aware of the showCloseButton feature, but is there a way I can enable or disable this on a per tab basis?  i.e.  I want my first tab to be not closable, but all others are?




3 Replies 1 reply marked as answer

SK Satheesh Kumar Balasubramanian Syncfusion Team March 31, 2022 12:28 PM UTC

Hi Chris,

 

You can use the below customized style to achieve your requirement.

 

 

index.js:   

          <TabComponent

            showCloseButton={true}

            heightAdjustMode="Auto"

            id="defaultTab"

          >

            <TabItemsDirective>

              <TabItemDirective

                cssClass={customClass}

                header={headertext[0]}

                content={tabContent1}

              />

              <TabItemDirective header={headertext[1]} content={tabContent2} />

              <TabItemDirective header={headertext[2]} content={tabContent3} />

            </TabItemsDirective>

          </TabComponent>

 

index.css:   

.e-tab .e-tab-header.e-close-show .hide-close-icon .e-icons.e-close-icon {

  display: none;

}

 

Kindly try the above sample and let us know if this meets your requirement.

 

Regards,

Satheesh Kumar B


Marked as answer

CD Chris Dietz March 31, 2022 01:24 PM UTC

perfect thank you!



VM Vengatesh Maniraj Syncfusion Team April 1, 2022 03:40 AM UTC

You are most welcome!!!


Loader.
Up arrow icon