abradley2 / form-fields / FormControls.SuperSelect

A super select widget for Elm

TEA

view : Model -> Props a -> Html (Msg a)

View The view for displaying the element.

init : String -> ( Model, Platform.Cmd.Cmd (Msg a) )

Init Creates the initial model for the element. id should be a unique string identifier. The second argument are the Option records since these are often initially decided. If you are loading the options asynchronously as a response to user input, the options should be set via a setNewOptions in your update function.

update : Msg a -> Model -> Props a -> ( Model, Platform.Cmd.Cmd (Msg a), ( Maybe a, String ) )

Update The function for updating the element.

subscriptions : Props a -> Platform.Sub.Sub (Msg a)

subscriptions As this element requires listening to keyboard events, the subscriptions must be added to your main function so it may do so.

defaultProps : Props a

defaultProps Default properties for the element. The props actually passed in should generally have label set to a non-empty string


type Msg a
    = NoOp
    | TextInputMsg FormControls.TextInput.Msg
    | UnsetFocusedOption
    | SetFocusedOption Basics.Int
    | OptionSelected (Option a)
    | KeyPress (Props a) Basics.Int

Msg


type alias Model =
{ id : String
, textInputData : FormControls.TextInput.Model
, focusedOption : Maybe Basics.Int
, hasFocus : Basics.Bool 
}

model


type alias Props a =
{ id : String
, options : List (Option a)
, errorText : Maybe String
, helperText : Maybe String
, label : String
, value : Maybe a
, inputValue : String 
}

props


type alias Option a =
( String, a )

Option Option for the select menu