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

Phone Input

Phone Input is a specialized form control for phone numbers with country selection, flag, dial code, formatting, and validation through libphonenumber-js.

Use it in profile, contact, billing, onboarding, checkout, support, invite, and contact forms when the value must be a real phone number.

Place ngs-phone-input inside one ngs-form-field and use Angular forms with formControlName or ngModel. Show invalidPhone with ngs-error. Use onlyCountries to limit available countries and preferredCountries to pin common countries to the top of the menu.

Do not use plain ngsInput, NumberInput, or InputMask for country-aware phone numbers. Do not use CountrySelect instead of PhoneInput; CountrySelect only chooses a country. Do not use PhoneInput for OTP, MFA, passcodes, or invite codes; use PinInput.

Key features:
  • Country selection with flag and dial code.
  • Country-aware formatting and validation.
  • Preferred and restricted country lists.
  • Angular forms integration and invalidPhone errors.
PropTypeDefault
autocomplete
Specifies whether autocomplete is applied to an editable text field.
on | offon
errorStateMatcher
Custom errorStateMatcher
ErrorStateMatcher
onlyCountries
List of iso codes of available country list
string[][]
preferredCountries
List of iso codes of available preferred country list
string[][]
format
Custom phone format
default | national | internationaldefault
defaultSelectedCountryCode
Default selected country code
stringus
placeholder
Input placeholder
string""
required
Whether the input is required
booleanfalse
disabled
Whether the input is disabled
booleanfalse
EventOutputDescription
countryChangedEventEmitter<Country>Executed when a country changed