indicatrix / elm-input-extra / MaskedInput.Text

Masked Text input

State


type State

Opaque type for storing local State

initialState : State

Initial state

View

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

Text input element

Example:

type Msg = InputUpdated String | StateUpdated MaskedInput.State | FocusUpdated Bool

MaskedInput.Text.input
    { pattern = "(###) ###-####"
    , inputCharacter = '#'
    , onInput = InputUpdated
    , toMsg = StateUpdated
    , hasFocus = Just FocusUpdated
    }
    [ class "masked-input"
    ...
    ]
    model.currentState
    model.currentValue


type alias Options msg =
{ pattern : String
, inputCharacter : Char
, onInput : String -> msg
, toMsg : State -> msg
, hasFocus : Maybe (Basics.Bool -> msg) 
}

Options of the input component.

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

Default value for Options.

Value:

{ pattern = ""
, inputCharacter = '#'
, onInput = onInput
, toMsg = toMsg
, hasFocus = Nothing
}