Dropdown
<k-dropdown>
This UI component hasn't been finalized yet. The functionality and syntax aren't stable and might be redone in an upcoming release. Only use it at your own risk - breaking changes are likely to occur.
Dropdowns are constructed with two elements: <k-dropdown>
is used as wrapper to position the dropdown relatively to the button (or any other element) that serves as toggle. <k-dropdown-content>
holds any content shown when opening the dropdown: any number of <k-dropdown-item>
elements or any other HTML.
Slots
Slot | Description |
---|---|
default |
Example
Items
as array
Instead of adding k-dropdown-item
elements manually, you can also inject them with an array
from dropdown extension
Using a Panel dropdown extension, you can simply reference it like this:
from an async function (e.g. API call)
The item array can also be returned in an options handler to dynamically load options
from an JSON API endpoint
Dropdown items can also be fetched from a JSON endpoint:
This will fetch the options only as soon as the dropdown will be opened.
CSS classes
.k-dropdown
.k-dropdown-content
.k-dropdown-item