{"id":15193860,"url":"https://github.com/peterstaev/nativescript-masked-text-field","last_synced_at":"2025-10-27T20:31:01.817Z","repository":{"id":57308610,"uuid":"90367121","full_name":"PeterStaev/nativescript-masked-text-field","owner":"PeterStaev","description":":hash: A NativeScript Masked Text Field widget","archived":false,"fork":false,"pushed_at":"2019-08-20T18:47:21.000Z","size":2191,"stargazers_count":25,"open_issues_count":9,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T08:02:18.471Z","etag":null,"topics":["android","ios","mask","maskedinput","maskedtextfield","nativescript","tangra","ui","widget"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PeterStaev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-05T11:00:07.000Z","updated_at":"2024-05-30T16:01:11.000Z","dependencies_parsed_at":"2022-08-29T02:52:04.386Z","dependency_job_id":null,"html_url":"https://github.com/PeterStaev/nativescript-masked-text-field","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-masked-text-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-masked-text-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-masked-text-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterStaev%2Fnativescript-masked-text-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PeterStaev","download_url":"https://codeload.github.com/PeterStaev/nativescript-masked-text-field/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238552997,"owners_count":19491355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","mask","maskedinput","maskedtextfield","nativescript","tangra","ui","widget"],"created_at":"2024-09-27T22:05:55.747Z","updated_at":"2025-10-27T20:31:01.236Z","avatar_url":"https://github.com/PeterStaev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**This repo only supports NativeScript pre-6.0. The latest version of the plugin supporting NS 6+ is availble as part of [ProPlugins](https://proplugins.org).**\n# NativeScript Masked Text Field widget \n[![Build Status](https://travis-ci.org/PeterStaev/nativescript-masked-text-field.svg?branch=master)](https://travis-ci.org/PeterStaev/nativescript-masked-text-field)\n[![npm downloads](https://img.shields.io/npm/dm/nativescript-masked-text-field.svg)](https://www.npmjs.com/package/nativescript-masked-text-field)\n[![npm downloads](https://img.shields.io/npm/dt/nativescript-masked-text-field.svg)](https://www.npmjs.com/package/nativescript-masked-text-field)\n[![npm](https://img.shields.io/npm/v/nativescript-masked-text-field.svg)](https://www.npmjs.com/package/nativescript-masked-text-field)\n\nA NativeScript Masked Text Field widget. The widget extends the default NativeScript TextField widget\nand adds ability to define masks for the input. \n\n## Screenshot\n![Screenshot of iOS and Android](https://raw.githubusercontent.com/PeterStaev/nativescript-masked-text-field/master/docs/screenshot.jpg)\n\n## Installation\nRun the following command from the root of your project:\n\n`tns plugin add nativescript-masked-text-field`\n\nThis command automatically installs the necessary files, as well as stores nativescript-masked-text-field as a dependency in your project's `package.json` file.\n\n## Configuration\nThere is no additional configuration needed!\n\n## API\nNOTE: Since the widget extends the default TextFeild NatvieScript widget it has all the properties/events/methods of the TextField widget. The below-mentioned properties are in addition to the TextField ones\n\n### Instance Properties\n* **mask** - *string*  \nGets or sets the mask for the text field. Possible tokens in the mask:\n  * `0` - Digit\n  * `9` - Digit or space\n  * `#` - Digit or `+` or `-`\n  * `L` - ASCII Letter\n  * `?` - ASCII Letter or space\n  * `\u0026` - Non-whitepsace character\n  * `C` - Any charcter\n  * `A` - ASCII Letter or digit\n  * `a` - ASCII Letter or digit or space\n  \n  If you want to escape any token character you can use `\\` (for example `\\9`)\n\n## Usage\nYou need to add `xmlns:mtf=\"nativescript-masked-text-field\"` to your page tag, and then simply use `\u003cmtf:MaskedTextField/\u003e` in order to add the widget to your page.\n```XML\n\u003c!-- test-page.xml --\u003e\n\u003cPage xmlns=\"http://schemas.nativescript.org/tns.xsd\" xmlns:mtf=\"nativescript-masked-text-field\"\u003e\n    \u003cStackLayout\u003e\n        \u003cmtf:MaskedTextField text=\"{{ value }}\" mask=\"(999) 999-9999\" keyboardType=\"phone\"/\u003e\n    \u003c/StackLayout\u003e\n\u003c/Page\u003e\n```\n\n## Usage in Angular\nIn order to be able to use the widget you just need to import `MaskedTextFieldModule` in `NgModule`:\n```typescript\nimport { MaskedTextFieldModule } from \"nativescript-masked-text-field/angular\";\n// ......\n@NgModule({\n    // ......\n    imports: [\n        // ......\n        MaskedTextFieldModule,\n        // ......\n    ],\n    // ......\n})\n```\n\n##### Example Usage\n```TypeScript\n// main.ts\nimport { NgModule } from \"@angular/core\";\nimport { NativeScriptModule } from \"nativescript-angular/nativescript.module\";\nimport { platformNativeScriptDynamic } from \"nativescript-angular/platform\";\nimport { MaskedTextFieldModule } from \"nativescript-masked-text-field/angular\";\nimport { AppComponent } from \"./app.component\";\n\n@NgModule({\n    declarations: [ AppComponent ],\n    bootstrap:    [ AppComponent ],\n    imports:      [\n        NativeScriptModule,\n        MaskedTextFieldModule,\n    ],\n})\nclass AppComponentModule {\n}\n\nplatformNativeScriptDynamic().bootstrapModule(AppComponentModule);\n```\n\n```HTML\n\u003c!-- app.component.html --\u003e\n\u003cStackLayout\u003e\n    \u003cMaskedTextField class=\"input input-border\" mask=\"(999) 999-9999\" [(ngModel)]=\"value\" keyboardType=\"phone\"\u003e\u003c/MaskedTextField\u003e\n\u003c/StackLayout\u003e\n```\n\n```TypeScript\n// app.component.ts\nimport { Component } from \"@angular/core\";\n\n@Component({\n    selector: \"my-app\",\n    templateUrl:\"app.component.html\",\n})\nexport class AppComponent {\n    public value = \"\";\n}\n```\n\n## Demos\nThis repository includes both Angular and plain NativeScript demos. In order to run those execute the following in your shell:\n```shell\n$ git clone https://github.com/peterstaev/nativescript-masked-text-field\n$ cd nativescript-masked-text-field\n$ npm install\n$ npm run demo-ios\n```\nThis will run the plain NativeScript demo project on iOS. If you want to run it on Android simply use the `-android` instead of the `-ios` sufix. \n\nIf you want to run the Angular demo simply use the `demo-ng-` prefix instead of `demo-`. \n\n## Donate\n[![Donate](https://img.shields.io/badge/paypal-donate-brightgreen.svg)](https://bit.ly/2AS9QKB)\n\n`bitcoin:14fjysmpwLvSsAskvLASw6ek5XfhTzskHC`\n\n![Donate](https://www.tangrainc.com/qr.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterstaev%2Fnativescript-masked-text-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterstaev%2Fnativescript-masked-text-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterstaev%2Fnativescript-masked-text-field/lists"}