onchange
Description
Fires when the state of the Two State button changesUsage
onchange?: (ev: { value: boolean }) => void;
Parameters
The callback of the event takes an object with the following parameter:
- value - (required) defines if the button is pressed ("true") or unpressed ("false")
Example
<script>
function handleChange({value}){
console.log(value);
}
</script>
<TwoState onchange={handleChange}/>
Details
The handler function receives an object with the button state which can be "true" or "false".
Related article: Catching the change of selected options