Duration
8 min
Access
Pro
Transcript
Available

Since there is no select or dropdown component backed in into elm-ui, we will be adding another dependency to our project called PaackEng/elm-ui-dropdown and adding to it additional styles and settings so that it looks and behaves exactly as we want to.

To make this works, we need to make a few changes:

  • We need to add a dropdownState : Dropdown.State String to our Model
  • Add a couple of extra variants to our Msg type: OptionPicked (Maybe String), to be dispatched by our dropdown whenever we click on any option, and DropdownMsg (Dropdown.Msg String) to update the internal state of the dropdown from the outside.
  • Construct our hardcoded list of options of type List String.
  • Define a dropdownConfig : Dropdown.Config String Msg that is going to contain all our customisation of our dropdown.
  • Use Dropdown.view to display our custom dropdown wherever we need it.