Skip to content

Events

EventsDescription
on_change(optional) will be called on state changes made by the user. Returns an object with the new selected data item { data, event, attributes, value }.
on_select(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, active_item }. The active_item property is the currently selected item by keyboard navigation
on_show(optional) will be called once the user presses the dropdown. Returns the data item { data, attributes }.
on_hide(optional) will be called once the user presses the dropdown again, or clicks somewhere else. Returns the data item { data, attributes }.

The on_change vs on_select difference

The difference between on_change and on_select is:

  • on_change will be called when the state changes, either with a click or space/enter keypress confirmation.
  • on_select 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.