Events
| Property | Type | Description |
|---|---|---|
on_change | function | (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 | function | (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 | function | (optional) will be called once the user presses the dropdown. Returns the data item { data, attributes }. |
on_hide | function | (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_changewill be called when the state changes, either with a click or space/enter keypress confirmation.on_selectdiffers 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.