Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ngx-textmask

laijuthomas721MIT1.5.0TypeScript support: included

Angular directive for input text masking

angular2, angular, angular 18, angular 19, angular 20, standalone, ng2, angular2 component, angular2 directive, ngx textmask, text mask, input mask, string mask, input formatting, text formatting, string formatting

readme

Angular Input Mask

Getting started

First, install using below command. Note: The below method is for standalone components

npm i ngx-textmask --save

Then, use it in your component:

import { NgModule } from '@angular/core';
import { MaskedInputDirective } from 'ngx-textmask';

@Component({
  selector: 'app',
  imports: [
    MaskedInputDirective
  ],
  template: `
    <input [textMask]="{mask: mask}"  type="text"/>
  `
})
export class AppComponent {
  public myModel = ''
  public mask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
}

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.5.0 (2025-09-22)

Features

  • core: add conformToMask in public api (1ba4092)

1.4.0 (2025-07-17)

Features

  • core: update angular v19 (545f0c8)
  • core: update angular v20 (97ba912)
  • core: update eslint v20 (eef7951)

Bug Fixes

1.3.0 (2024-10-24)

Features

  • core: update angular version to angular 18

1.2.0 (2024-10-24)

Features

  • core: update angular version to angular 17

1.1.0 (2024-03-22)

Features

  • core: add angular library and source code (e5f1f7e)
  • core: add example for US phone number mask (1a5d49e)
  • core: add release packages (8aaee1e)