Dropdowns always consist of a wrapping
k-dropdown element and the
k-dropdown-content element. The wrapper is used for positioning, so the dropdown will open relatively to the button or any other element that serves as the toggle. The dropdown content can contain any number of
k-dropdown-item elements or any other HTML
k-dropdown-item elements inherit all the attributes from
k-button elements, like
Instead of adding
k-dropdown-item elements manually, you can also inject them with an array
The item array can also be returned in an options handler to dynamically load options
Dropdown items can also be fetched from a JSON endpoint:
This will fetch the options only as soon as the dropdown will be opened.
Dropdowns can be aligned left (default) or right.
k-dropdown-content element has three available methods:
k-dropdown-content element emits two events, which you can listen to: