Skip to main content

onChange

Description

Fires when radio buttons are checked

Usage

onChange?: (event: { value: (string | number)[] }) => void;

Parameters

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

  • value - (array) an array of ids of the selected radio buttons

Example

type ChangeEvent = { value: (string | number)[] };

function Example() {
const handleChange = ({ value }: ChangeEvent) => {
console.log(value);
};

return <RadioButtonGroup onChange={handleChange} />;
}

Details

The handler function receives an object with an array of ids of the selected radio buttons.