Skip to main content

onchange

Description

Optional. Fires when a new value is selected in the control

Usage

onchange?: (ev: { value: string }) => void;

Parameters

The callback of the event takes an object with the following parameter:

  • value - (required) HEX code of the newly selected color

Example

<script setup>
function handleChange({value}){
console.log(value);
// HEX code
}
</script>

<template>
<ColorSelect :onchange="handleChange"/>
</template>

Details

The handler function receives an object with the HEX code of the newly selected color.

Related article: Catching the change of selected options