Get updates via , Github, or RSS | About

Episode 43: Elm-Multiselect Aug 3, 2017

Elm-Multiselect is a simple package for creating tokenizing search inputs. These inputs are pefect for the “To” field of a multi-user messaging application, or anytime you want to allow searching for and selecting multiple results.

Examples

Main.elm

update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        MultiselectMsg msg ->
            Multiselect.update msg model.multiselect
                |> Tuple.mapFirst (\m -> { model | multiselect = m })
                |> Tuple.mapSecond (Cmd.map MultiselectMsg)

View.elm

view : Model -> Html Msg
view model =
    div []
        [ label [ for "multiselectInputto_field" ] [ text "To:" ]
        , Html.map MultiselectMsg <| Multiselect.view model.multiselect
        ]