ChatiumFor developersPlaygroundPricing
Sign in

PhoneInput

Properties

  • value (string):
    Initial value of the phone number in string format.
  • country ('RUS'):
    Country code for the phone number. In this version, only RUS is supported.
  • onInput (function(value: string, event?: InputEvent)):
    Handler function for changes in the input field value. Called every time the value changes. Returns a string with the phone number without formatting.
  • waiting (boolean):
    If true, a loading indicator (spinner) is displayed to the right of the input field.
  • formId (string):
    Identifier of the form associated with the input field.
  • store ([get: any, set: (field: string, value: string) => void]):
    Storage for managing state. Allows you to control the value through an array of functions.

Important Points

  • formatPhone:
    Function for formatting the phone number into a readable format. For example, input "1234567890" will be transformed into "+7 (123) 456-78-90" for Russia.
  • formatPhoneBack:
    Function for removing formatting from the phone number, returning a string in the format "+71234567890".
  • countryCode:
    Function for obtaining the country phone code. In the current version, it returns the code +7 for Russia.