Constructor
new Dropdown(target, options)
options = {
items: object (object with entries for dropdown),
showDeselectItem: boolean
deselectLabel: string
}
Parameters:
Name | Type | Description |
---|---|---|
target |
HTMLElement | string | |
options |
object |
- Source:
Methods
addItem(key, item, css)
Add an item to the dropdown
Parameters:
Name | Type | Description |
---|---|---|
key |
string | |
item |
* | |
css |
object | (optional) styling for dropdown item |
- Source:
clear()
Remove all items
- Source:
createItemElement_(text, title, css) → {HTMLElement}
Helper method for creating the
HTMLElement of an item
Parameters:
Name | Type | Description |
---|---|---|
text |
string | |
title |
string | |
css |
object |
- Source:
Returns:
element
- Type
- HTMLElement
deselect()
Set the dropdown menu to deselected.
- Source:
getSelectedItem()
Get the currently selected color item
- Source:
search(query)
Search in titles and add to dropdown
Parameters:
Name | Type | Description |
---|---|---|
query |
string |
- Source:
select(key)
Selet an item by the given key
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
- Source:
setItems(items)
Set the available items in the dropdown
Parameters:
Name | Type | Description |
---|---|---|
items |
object |
- Source: