leonardanyer / elm-combox / Combox

This is a custom dropdown based on elm-selectize.

type alias Model =
    { language : Combox.Model }

init : ( Model, Cmd Msg )
init =
    ( { language = Accordion.empty }, Cmd.none )

type Msg
    = ComboxMsg String Combox.Msg

update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        ComboxMsg selectizeMsg ->
            let
                ( language, cmd ) =
                    Combox.update msg model.combox
            in
            ( { model | language = language }, Cmd.map ComboxMsg cmd )

view : Model -> Html Msg
view model =
    Html.div []
        [ Html.h3 [] [ Html.text "Dropdown Menus" ]
        , Combox.config ComboxMsg
            |> Combox.clear False
            |> Combox.view model.language
        ]


type alias Model =
{ name : String
, selection : Maybe String
, menu : Selectize.State String 
}

Define the dropdown identifier and basic elm-selectize model


type Msg
    = MenuMsg (Selectize.Msg String)
    | Select (Maybe String)

The custom dropdown menu produces these messages.

config : (Msg -> msg) -> Config msg

Create an initial configuration by calling the config function

view : Model -> Config msg -> Html msg

Create the view configuration, for example

view : Model -> Html Msg
view model =
    Html.div []
        [ Html.h3 [] [ Html.text "Dropdown Menus" ]
        , Combox.config ComboxMsg
            |> Combox.view model.language
        ]

update : Msg -> Model -> ( Model, Platform.Cmd.Cmd Msg )

Update the status of the drop-down menu.

initial : String -> Maybe String -> List String -> Model

Initialize model with data

empty : Model

Initialize empty model

title : String -> Config msg -> Config msg

change the current settings of the title

placeholder : String -> Config msg -> Config msg

change the current settings of the placeholder

clear : Basics.Bool -> Config msg -> Config msg

change the current settings of clear

options : List (Html.Attribute Msg) -> Config msg -> Config msg

Change the current settings of the options

disabled : Basics.Bool -> Config msg -> Config msg

change the current settings of disabled