abadi199/elm-input-extra/5.2.1

NOTE: this package is not compatible with Elm 0.19.1

Input.Text

Text input

View

input : Options msg -> List (Attribute msg) -> String -> Html msg

Text input element

Example:

type Msg = InputUpdated String | FocusUpdated Bool


Input.Text.input
    { maxLength = 10
    , onInput = InputUpdated
    , hasFocus = Just FocusUpdated
    }
    [ class "textInput"
    ...
    ]
    model.currentValue
type alias Options msg =
{ maxLength : Maybe Int
, onInput : String -> msg
, hasFocus : Maybe (Bool -> msg)
, type_ : String
}

Options of the input component.

* maxLength is the maximum number of character allowed in this input. Set to Nothing for no limit. * onInput is the Msg tagger for the onInput event. * hasFocus is an optional Msg tagger for onFocus/onBlur event. * type_ is the type of the HTML input element.

defaultOptions : (String -> msg) -> Options msg

Default value for Options. * onInput (type: String -> msg) : The onInput Msg tagger

Value:

{ maxLength = Nothing
, onInput = onInput
, hasFocus = Nothing
, type_ = "text"
}