Phone
Importβ
import { Phone } from '@resultadosdigitais/tangram-components'
Propertiesβ
value
β
Type | any |
---|
Descriptionβ
Sets input's value. Equivalent to the defaultValue
, the component Phone
is not controllable.
If present, this property must always come with the +
sign and country calling code,
for example: "+5522999213445"
, "+55 (22) 99921-3445"
are correct,
but "5522999213445"
, "55 (22) 99921-3445"
, "(22) 99921-3445"
are incorrect.
defaultValue
β
Type | any |
---|
Descriptionβ
Sets input's value.
If present, this property must always come with the +
sign and country calling code,
for example: "+5522999213445"
, "+55 (22) 99921-3445"
are correct,
but "5522999213445"
, "55 (22) 99921-3445"
, "(22) 99921-3445"
are incorrect.
defaultCountry
β
Type | Phone.allowedCountries |
---|
Descriptionβ
Country code initially selected when value
and defaultValue
are not present.
If this property is not present, as well as value
and defaultValue
,
the component will try to infer the country code through browser language,
or will initialize with the Brazil code ("BR"
) by default.
disabled
β
error
β
onChange
β
Type | func |
---|---|
Param | event React.SyntheticEvent - The event source of the callback. |
Param | phone string - The input phone number, without mask, with the country calling code. |
Param | infos object - Additional information about component status. |
Descriptionβ
Callback fired when the value changes.
onClear
β
Type | func |
---|---|
Param | event React.SyntheticEvent - The event source of the callback. |
Param | phone string - The input phone number. In this event, it will always be an empty string ('' ). |
Param | infos object - Additional information about component status. |
Descriptionβ
A callback called when the clear button is clicked.
onBlur
β
Type | func |
---|---|
Param | event React.SyntheticEvent - The event source of the callback. |
Param | phone string - The input phone number, without mask, with the country calling code. |
Param | infos object - Additional information about component status. |
Descriptionβ
Callback fired when the input is blurred.
onFocus
β
Type | func |
---|---|
Param | event React.SyntheticEvent - The event source of the callback. |
Param | phone string - The input phone number, without mask, with the country calling code. |
Param | infos object - Additional information about component status. |
Descriptionβ
Callback fired when the input is focused.
countryNames
β
Type | objectOf |
---|---|
Default | Phone.translations.en.countryNames |
Descriptionβ
Custom name for countries.
It should be an object in the format { US: 'Estados Unidos', BR: 'Brasil', ... }
.
The list with the allowed country codes by the component can be consulted
under Phone.allowedCountries
.
Preset values for English, Brazilian Portuguese and Spanish are available
in Phone.translations.en.countryNames
, Phone.translations.ptBR.countryNames
and
Phone.translations.es.countryNames
.
countryCallingCodeLabelText
β
Type | string |
---|---|
Default | Phone.translations.en.countryCallingCode |
Descriptionβ
Custom text for the label that identifies the country calling code in the component. This text is not displayed on the screen.
Preset values for English, Brazilian Portuguese and Spanish are available
in Phone.translations.en.countryCallingCode
,
Phone.translations.ptBR.countryCallingCode
and
Phone.translations.es.countryCallingCode
.
selectedCountryLabelText
β
Type | string |
---|---|
Default | Phone.translations.en.selectedCountry |
Descriptionβ
Custom text for the label that identifies the country list in the component. This text is not displayed on the screen.
Preset values for English, Brazilian Portuguese and Spanish are available
in Phone.translations.en.selectedCountry
,
Phone.translations.ptBR.selectedCountry
and
Phone.translations.es.selectedCountry
.
clearLabelText
β
Type | string |
---|---|
Default | Phone.translations.en.clear |
Descriptionβ
Custom text for the label that identifies the clear icon in the component. This text is not displayed on the screen.
Preset values for English, Brazilian Portuguese and Spanish are available
in Phone.translations.en.clear
,
Phone.translations.ptBR.clear
and
Phone.translations.es.clear
.
unidentifiedCountryTooltip
β
Type | string |
---|---|
Default | Phone.translations.en.unidentifiedCountry |
Descriptionβ
Custom text for the tooltip displayed when the country cannot be identified.
Preset values for English, Brazilian Portuguese and Spanish are available
in Phone.translations.en.unidentifiedCountry
,
Phone.translations.ptBR.unidentifiedCountry
and
Phone.translations.es.unidentifiedCountry
.