abadi199/elm-input-extra/5.1.0

NOTE: this package is not compatible with Elm 0.19.1

Input.Number

Number input

View

input : Options msg -> List (Attribute msg) -> Maybe Int -> Html msg

View function

Example:

type Msg = InputUpdated String | FocusUpdated Bool


Input.Number.input
    { onInput = InputUpdated
    , maxLength = Nothing
    , maxValue = 1000
    , minValue = 10
    , hasFocus = Just FocusUpdated
    }
    [ class "numberInput"
    ...
    ]
    model.currentValue
type alias Options msg =
{ maxLength : Maybe Int
, maxValue : Maybe Int
, minValue : Maybe Int
, onInput : Maybe Int -> msg
, hasFocus : Maybe (Bool -> msg)
}

Options of the input component.

* maxLength is the maximum number of character allowed in this input. Set to Nothing for no limit. * maxValue is the maximum number value allowed in this input. Set to Nothing for no limit. * minValue is the minimum number value 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.

defaultOptions : (Maybe Int -> msg) -> Options msg

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

Value:

{ onInput = onInput
, maxLength = Nothing
, maxValue = Nothing
, minValue = Nothing
, hasFocus = Nothing
}