Dropdown component
Opaque type that holds the current state
Opaque type for internal library messages
Create a new configuration. This takes:
A message to trigger when an item is selected
A function to get a label to display from an item
Dropdown.newConfig OnSelect .label
Show or hide the clear (x) button, default is true
Dropdown.withClear False configAdd a prompt text to be displayed when no element is selected
Dropdown.withPrompt "Select a movie" configAdd classes to the arrow wrapper
Dropdown.withArrowClass "arrow" configAdd styles to the arrow wrapper
Dropdown.withArrowStyles [ ( "color", "red" ) ] configAdd classes to the arrow svg icon
Dropdown.withArrowSvgClass "arrow" configAdd classes to the clear button wrapper
Dropdown.withClearClass "clear" configAdd styles to the clear button wrapper
Dropdown.withClearStyles [ ( "color", "red" ) ] configAdd classes to the clear icon
Dropdown.withClearSvgClass "clear" configAdd classes to the items in the list
Dropdown.withItemClass "bg-white" configAdd styles to the items in the list
Dropdown.withInputStyles [ ( "color", "red" ) ] configAdd classes to the menu (list of items)
Dropdown.withMenuClass "bg-white" configAdd styles to menu
Dropdown.withMenuStyles [ ( "color", "red" ) ] configAdd classes to the prompt text (When no item is selected)
Dropdown.withPromptClass "prompt" configAdd styles to prompt text
Dropdown.withPromptStyles [ ( "color", "red" ) ] configAdd classes to currently selected item in the menu
Dropdown.withSelectedClass "bg-white" configAdd styles to currently selected item in the menu
Dropdown.withSelectedStyles [ ( "color", "red" ) ] configAdd classes to trigger element
Dropdown.withTriggerClass "bg-white" configAdd styles to trigger element
Dropdown.withTriggerStyles [ ( "width", "100px" ) ] configCreate a new state. You must pass a unique identifier for each select component.
{
...
dropdownState = Dropdown.newState "dropdown1"
}Render the view
Html.map DropdownMsg (Dropdown.view dropdownConfig model.dropdownState model.items selectedItem)
Opaque type that holds the configuration