I have created the custom tab as given below , how can i store the name of the active tab value in a variable in my JS file.
even when user switch tab , label of the current tab should get stored in the variable of the JS file.
Below is the code:
<template>
<lightning-tabset class='slds-tabs_default' active-tab-value='Item One'>
<lightning-tab label="Item One" value="1" default>
Here's the content for Item One:
</lightning-tab>
<lightning-tab label="Item Two" value="2">
Here's the content for Item Two:
</lightning-tab>
<lightning-tab label="Item 3" value="3">
Here's the content for Item Two:
</lightning-tab>
<lightning-tab label="Item 4" value="4">
Here's the content for Item Two:
</lightning-tab>
</lightning-tabset>
</template>
import { LightningElement } from 'lwc';
export default class ActiveTabExample extends LightningElement {
@track activetabContent = '';
}
Whenever user changes the tab activetabContent must get updated with the current tab in the UI