Masked Number input, similar to Masked Text input, but only accepting numeric input
Initial state
Masked Number input element
Example:
type Msg = InputUpdated (Maybe Int) | StateUpdated MaskedInput.State | FocusUpdated Bool
MaskedInput.Number.input
{ pattern = "(###) ###-####"
, inputCharacter = '#'
, onInput = InputUpdated
, toMsg = StateUpdated
, hasFocus = Just FocusUpdated
}
[ class "masked-input"
...
]
model.currentState
model.currentValueOptions of the input component.
pattern is the pattern used to format the input value. e.g.: (###) ###-####inputCharacter: is the special character used to represent user input. Default value: #toMsg: is the Msg for updating internal State of the element.onInput is the Msg tagger for the onInput event.hasFocus is an optional Msg tagger for onFocus/onBlur event.Default value for Options.
onInput (type: Maybe Int -> msg) : The onInput Msg taggertoMsg (type: String -> msg) : The Msg for updating internal State of the element.Value:
{ pattern = ""
, inputCharacter = '#'
, onInput = onInput
, toMsg = toMsg
, hasFocus = Nothing
}
Opaque type for storing local State