An implementation of multiselect control built with and for Elm.
Please, check example/src/MinimalExample.elm for the minimal example on how to use this library.
initModel : List ( String, String ) -> String -> InputInMenu -> Model
Init model based on the values : List (String, String) and id : String provided by the user.
model =
{ multiselect = Multiselect.initModel [ ( "one", "The 1st option" ), ( "two", "The 2nd option" ), ( "three", "The 3rd option" ) ] "id_1"
}
getSelectedValues : Model -> List ( String, String )
Get selected values : List (String, String)
populateValues : Model -> List ( String, String ) -> List ( String, String ) -> Model
Populate model with values : List (String, String) and preselect selected : List (String, String).
clearInputText : Model -> ( Model, Platform.Cmd.Cmd Msg )
Clear the input text: (Model, Cmd Msg)
getValues : Model -> List ( String, String )
Get the full list of values : List (String, String)
Whether or to show the input field as the first result of the menu or not useful for tagging
Opaque type that holds the model
type alias Model =
{ multiselect : Multiselect.Model
}
Opaque type for internal library messages
Transparent type for external library messages
view : Model -> Html Msg
Render the view
Html.map MultiselectMsg <| Multiselect.view model.multiselect
update : Msg -> Model -> ( Model, Platform.Cmd.Cmd Msg, Maybe OutMsg )
Update the control state
MultiselectMsg subMsg ->
let
( subModel, subCmd ) =
Multiselect.update subMsg model.multiselect
in
{ model | multiselect = subModel } ! [ Cmd.map MultiselectMsg subCmd ]
subscriptions : Model -> Platform.Sub.Sub Msg
Subscribe for messages
Sub.map MultiselectMsg <| Multiselect.subscriptions model.multiselect