https://github.com/bthurlow/nativescript-maskedinput
A {N} masked input plugin for iOS and Android
https://github.com/bthurlow/nativescript-maskedinput
Last synced: 12 days ago
JSON representation
A {N} masked input plugin for iOS and Android
- Host: GitHub
- URL: https://github.com/bthurlow/nativescript-maskedinput
- Owner: bthurlow
- License: other
- Created: 2016-04-20T16:49:20.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-07T19:05:43.000Z (over 9 years ago)
- Last Synced: 2025-10-21T21:48:02.933Z (4 months ago)
- Language: TypeScript
- Size: 1.35 MB
- Stars: 8
- Watchers: 3
- Forks: 8
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nativescript - Masked Input - A {N} masked input plugin for iOS and Android. (Awesome {N} [](https://github.com/sindresorhus/awesome) / Table of Contents)
README
# A {N} Masked Input Plugin
[](http://choosealicense.com/licenses/mit/) [](https://www.npmjs.com/package/nativescript-maskedinput) [](https://www.npmjs.com/package/nativescript-maskedinput) [](https://github.com/bthurlow/nativescript-maskedinput)
This plugin extends the {N} TextView to allow for input masking.
## Notes
iOS 7+
Android API 17+
Plugin does not support the use of the keyboardType property from TextView.
Plugin will attempt to determine the mask type and display the appropriate keyboardType automatically.
## Installation
Run `tns plugin add nativescript-maskedinput`
### Usage
To use MaskedInput you need to include it in your XML.
Add the following to your page directive.
```xmlns
xmlns:mi="nativescript-maskedinput"
```
Use MaskedInput by adding the following XML.
```XML
```
### Properties
#### mask [string]
Get or Set the mask used for input
#### mask options
- 9 is the same as RegEx [0-9]
- a is the same as RegEx [A-Za-z]
- \* is the same as RegEx [A-Za-z0-9]
- ? specifies that anything after the ? is optional.
###### Supported Seperators
* -
* |
* /
* \
* .
* $
* +
* ( )
* [ ]
* { }
#### valid [boolean]
Returns true or false if the input text matches the mask.
Use the ```FormattedText``` property or the ```text``` property to validate the input.
#### placeholder [string]
Gets or Sets the placeholder.
Default: _
#### RawText [string]
Gets only the text that matches the RegEx pattern from the mask.
You cannot validate the RawText property. It will fail.
#### FormattedText [string]
Gets the Full text including any seperators as specified in the mask.
#### regEx [string]
Gets the regex that was created from the mask so that you can perform your own validation.