1.0.1 • Published 6 years ago

react-bootstrap-intl-tel-input v1.0.1

Weekly downloads
178
License
ISC
Repository
github
Last release
6 years ago

react-bootstrap-intl-tel-input

React international telephone input built on bootstrap v4

Versioning

bootstrap@4.0.0 = react-bootstrap-intl-tel-input ≤0.0.16

bootstrap@4.0.0-alpha.6 = react-bootstrap-intl-tel-input ≥1.0.0

Install

npm i react-bootstrap-intl-tel-input --save

Usage

import IntlTelInput from 'react-bootstrap-intl-tel-input'

<IntlTelInput
  preferredCountries={['US', 'GB']}
  defaultCountry={'US'}
  defaultValue={'+1 555-555-5555'}
  onChange={(data) => this.onChangeHandler(data)}
/>

Props

NameProp TypeDefault PropDetails
defaultValuenumber, stringDefault phone number. Can be either an international or national number. Placing a + in front of the calling code will allow the component to parse the number and automatically select the appropriate country.
preferredCountriesstring[][]Expects an array of ISO 3166-1 alpha-2 codes. Supplied values will be pushed to the top of the dropdown list.
onChangefunc()Passes back data regarding current phone number such as validation status, selected country information, and currently entered phone number.
disabledbooleanfalseToggles the disabled attribute of the tel input and country selector.
removeTokenelement, string<span>&times;</span>Token on the right side of the input that clears typeahead and phonenumber values when clicked.
paginatenumber50Specifies how many results to show at once in the dropdown list.
paginateTextelement, stringDisplay additional results...Text displayed once the user has scrolled to the bottom of the list.
noResultsMessagestringNo results availableMessage displayed when the typeahead search term yields no results.
minLengthMessagestringToo short to be a valid phone numberUser friendly validation message returned by the onChange function when the phone number is too short.
maxLengthMessagestringToo long to be a valid phone numberUser friendly validation message returned by the onChange function when the phone number is too long.
callingCodeMessagestringPlease select a valid country codeUser friendly validation message returned by the onChange function when a invalid country code is entered.
catchAllMessagestringNot a valid phone numberUser friendly validation message returned by the onChange function when all other validation messages are not applicable.
validMessagestringThis phone number is validUser friendly validation message returned by the onChange function when the phone number is valid.
placeholderstringSearch for a calling code by countryPlaceholder of the tel input.
maxHeightnumber300Max height of the country dropdown list.
defaultCountrystringUSDefault country to select when no defaultValue is supplied.
inputClassNamestringAdds classNames to the tel input.
callingCodeDividerelement, string<span>/</span>Token used between calling codes in the dropdown list.
resetbooleanWhen set to true, the input will be reset to its defaultValue
Note: All the validation messages are read to screen readers, so be sure to be descriptive!

Development

npm start
1.0.1

6 years ago

0.0.16

6 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

1.0.0

7 years ago