Skip to content

Events

PropertyTypeDescription
onChangefunction(optional) will be called on state changes made by the user. Returns an object with the new selected data item { data, event, attributes, value }.
onSelectfunction(optional) will be called once the user focuses or selects an item by a click or keyboard navigation. Returns an object with the new selected data item { data, event, attributes, value, activeItem }. The activeItem property is the currently selected item by keyboard navigation.
onShowfunction(optional) will be called once the user presses the dropdown. Returns the data item { data, attributes }.
onHidefunction(optional) will be called once the user presses the dropdown again, or clicks somewhere else. Returns the data item { data, attributes }.

The onChange vs onSelect difference

The difference between onChange and onSelect is:

  • onChange will be called when the state changes, either with a click or space/enter keypress confirmation.
  • onSelect differs most when the user is navigating by keyboard. Once the user is pressing e.g. the arrow keys, the selection is changing, but not the state.