Skip to content

agustinrhcp/elm-mask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mask

Simple input and string masking library.

Example

type Msg
    = PhoneUpdated String


type alias Phone =
    { number : String

    -- ...
    }


update : Msg -> Phone -> Phone
update msg phone =
    case msg of
        PhoneUpdated number ->
            { phone | number = number }


phonePattern : Pattern
phonePattern =
    Mask.fromString "(###)###-####"


view : Phone -> Html msg
view { number } =
    input
        [ maskedValue phonePattern number
        , onMaskedInput phonePattern number PhoneUpdated
        ]
        []

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages