Skip to main content

change

Description

fires when a new tab is selected in the control

Parameters

  • ev - (object) a CustomEvent object. Its detail property contains:
    • value - (number) the id of the newly selected tab

Example

<script>
function handleChange(ev) {
active = ev.details.value;
console.log(active);
// => 2
}
</script>

<Tabs options={tabs} value={0} on:change={handleChange} />

Details

The handler function returns the id of a newly selected tab.

Related article: Catching the change of the selected tab

Related sample: Tabs