Getting Started
Overview
Installation
Theme
Forms
Basic Inputs
Select
Custom Inputs
Components
Navigation
Components
69
Micro Charts
Libraries
Kanban Board
Image Designer
Video Player
Visual Builder
Content Editor
Data View
Latest npm version of @ngstarter-ui/componentsWeekly npm downloads of @ngstarter-ui/components
Purchase

Input Mask

Input Mask provides ready-made directives for formatting credit card inputs while the user types. Use the mask directives on native input elements, usually together with ngsInput inside ngs-form-field.

The available masks are ngsCreditCardNumberMask, ngsCreditCardExpiryDateMask, and ngsCreditCardCvvMask. They format the visible value, set useful mobile keyboard and autocomplete attributes where applicable, and write a cleaned form value for card number and expiry.

Do not treat Input Mask as a universal mask engine, validator, payment security layer, or compliance solution. Do not use it for phone numbers, custom IDs, tax numbers, IBAN, postal codes, date pickers, selects, currency or country fields, or formatting already saved data. Use PhoneInput, dedicated field components, validators, backend checks, or a custom mask directive for those cases.

Key features:
  • Formats card number, expiry date, and CVV/CVC fields while users type.
  • Works with native inputs and NgStarter Input/FormField composition.
  • Keeps form values cleaner than the visible formatted text where supported.

CreditCardNumberMaskDirective

PropTypeDefault
placeholder
The placeholder text for the input field
string0000 0000 0000 0000

CreditCardExpiryDateMaskDirective

PropTypeDefault
placeholder
The placeholder text for the input field
stringMM/YY

CreditCardCvvMaskDirective

PropTypeDefault
placeholder
The placeholder text for the input field
string•••