Hey! I have been playing with elm for the past 3-4 weeks, I am an analytics manager by day so I am not a programmer. I would advice to stick with it for few weeks because while it does get weird at times once it “clicks” you can appreciate the beauty of everything (like not having to do html and css, for starters).
Anyway, I actually have done this. You can build your own elements and then wrap them in the elm-ui* html function. This way you can add your own elements to elm-ui.
`* Just use elm-ui when you are starting, you’ll understand better why doing things in elm pays off.
import Element as El exposing (column, html, layout, text)
import Html as Html exposing (Html, div, option, select, text)
buildSelect : List Model -> El.Element SelectedMsg
buildSelect options =
El.html -- <- this one wraps an Html Msg type into an El.Element Msg type
(select -- <- This one is from elm-html library
[ Events.on "change" <|
D.map SelectedOption Events.targetValue
(List.map strToOption <| List.map .selectedOption countries)
And here is the beautiful part, you can now use
buildSelect inside an elm-ui layout:
[ Model "Italy", Model "Spain", Model "Germany" ]
view : Model -> Html Msg
view model =
El.layout  <|
[ buildSelect countries
, El.text model.selectedOption
If this helps, let me know I can clean up my code and put a working example with comments on github.
As for “should we have select elements in our UIs”, I don’t know. I know from working in enterprise that anything you change for your end users is going to impact adoption. Since I am looking to use Elm more in enterprise/analytics settings and here people use drop downs daily (i.e. Excel), I don’t think I can afford at this point to remove them.