A super select widget for Elm
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
Msg
TextInputMsg
the messages used by the underlying TextInput
elementOptionSelected
fired when an option is selected{ id : String
, textInputData : FormControls.TextInput.Model
, focusedOption : Maybe Basics.Int
, hasFocus : Basics.Bool
}
model
id
The unique id of the element. This is passed as the first argument to init
value
The currently selected optioninputValue
The text input value for the underlying TextInput
elementtextInputData
Key for allocating the model of the underlying TextInput
element{ id : String
, options : List (Option a)
, errorText : Maybe String
, helperText : Maybe String
, label : String
, value : Maybe a
, inputValue : String
}
props
errorText
If you wish to communicate the selection as invalid, set it to the error messagehelperText
Helper text to guide the user's input. Not shown if errorText
is set to non-Nothing
label
input label for the text input( String, a )
Option Option for the select menu