Skip to main content

select

Description

fires when a new segment is selected in a segmented button

Parameters

  • ev - (object) a CustomEvent object. Its detail property contains:
    • selected - (object) an object with the id of the newly selected segment

Example

<script>
function handleSelect(ev) {
const newSelection = ev.detail;
console.log(newSelection);
// => {id:2}
}
</script>

<Segmented value={1} on:select={handleSelect}/>

Details

The handler function receives an object with the id of the newly selected segment.

Related article: Catching the change of the selected segment