Dropdown
<k-dropdown>
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
k-dropdown-item
elements inherit all the attributes from k-button
elements, like link
, icon
or image
Items Array
Instead of adding k-dropdown-item
elements manually, you can also inject them with an array
Dynamic items
The item array can also be returned in an options handler to dynamically load options
Loading items
Dropdown items can also be fetched from a JSON endpoint:
This will fetch the options only as soon as the dropdown will be opened.
Alignment
Dropdowns can be aligned left (default) or right.
Methods
The k-dropdown-content
element has three available methods:
open
close
toggle
Events
The k-dropdown-content
element emits two events, which you can listen to:
open
close
CSS classes
k-dropdown
.k-dropdown
k-dropdown-content
.k-dropdown-content
k-dropdown-item
.k-dropdown-item