abradley2/form-fields/1.0.0

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/abradley2/form-fields is gone (deleted or private); Software Heritage has no tag 1.0.0 for it; no fork with tag 1.0.0 found (60 same-name repos checked); no cached copy. Use another version.

Details

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, 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.

Msg a
-> Model
-> Props a
-> ( Model, Cmd (Msg a), ( Maybe a, String ) )

Update The function for updating the element.

subscriptions : Props a -> 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 Msg
| UnsetFocusedOption
| SetFocusedOption Int
| OptionSelected (Option a)
| KeyPress (Props a) Int

Msg

  • TextInputMsg the messages used by the underlying TextInput element
  • OptionSelected fired when an option is selected
type alias Model =
{ id : String
, textInputData : Model
, focusedOption : Maybe Int
, hasFocus : Bool
}

model

  • id The unique id of the element. This is passed as the first argument to init
  • value The currently selected option
  • inputValue The text input value for the underlying TextInput element
  • textInputData Key for allocating the model of the underlying TextInput element
type alias Props a =
{ 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 message
  • helperText Helper text to guide the user's input. Not shown if errorText is set to non-Nothing
  • label input label for the text input
type alias Option a =
( String, a )

Option Option for the select menu