Gathering detailed insights and metrics for dyxbenjamin-mui-phone-number
Gathering detailed insights and metrics for dyxbenjamin-mui-phone-number
Gathering detailed insights and metrics for dyxbenjamin-mui-phone-number
Gathering detailed insights and metrics for dyxbenjamin-mui-phone-number
Fork of react-phone-input-2 for the Material-UI library
npm install dyxbenjamin-mui-phone-number
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
2,029
Last Day
2
Last Week
18
Last Month
85
Last Year
576
98 Commits
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
2.0.3
Package Id
dyxbenjamin-mui-phone-number@2.0.3
Unpacked Size
403.15 kB
Size
102.11 kB
File Count
29
NPM Version
8.5.5
Node Version
16.15.0
Cumulative downloads
Total Downloads
Last day
100%
2
Compared to previous day
Last week
20%
18
Compared to previous week
Last month
102.4%
85
Compared to previous month
Last year
-5.6%
576
Compared to previous year
2
30
Highly customizable phone input component with auto formatting. Based on the wonderful react-phone-input-2 package.
It looks like this, but in Material Design:
Uses @material-ui/core/TextField for rendering the phone input
1npm i dyxbenjamin-mui-phone-number
1import MuiPhoneNumber from 'material-ui-phone-number'; 2 3React.render( 4 <MuiPhoneNumber defaultCountry={'us'} onChange={handleOnChange}/>, 5 document.getElementById('root') 6);
Your handler for the onChange
event should expect a string as
parameter, where the value is that of the entered phone number. For example:
1function handleOnChange(value) {
2 this.setState({
3 phone: value
4 });
5}
Name | Type | Description | Example |
---|---|---|---|
excludeCountries | array | array of country codes to be excluded | ['cu','cw','kz'] |
onlyCountries | array | country codes to be included | ['cu','cw','kz'] |
preferredCountries | array | country codes to be at the top | ['cu','cw','kz'] |
defaultCountry | string | initial country | 'us' |
inputClass | string | class for input | |
dropdownClass | string | class for dropdown container | |
autoFormat | bool | on/off auto formatting, true by default | |
disableAreaCodes | bool | disable local codes for all countries | |
disableCountryCode | bool | false by default | |
disableDropdown | bool | false by default | |
enableLongNumbers | bool | false by default | |
countryCodeEditable | bool | true by default | |
Supported TextField props | |||
See TextField API for possible values https://material-ui.com/api/text-field/ |
Name | Type | Description |
---|---|---|
regions | array/string | to only show codes from selected regions |
Regions |
---|
['america', 'europe', 'asia', 'oceania', 'africa'] |
Subregions |
['north-america', 'south-america', 'central-america', 'carribean', 'european-union', 'ex-ussr', 'middle-east', 'north-africa'] |
Regions selected: {'europe'}
1<MuiPhoneInput 2 defaultCountry='it' 3 regions={'europe'} 4/>
Regions selected: {['north-america', 'carribean']}
1<MuiPhoneInput 2 defaultCountry='ca' 3 regions={['north-america', 'carribean']} 4/>
Name | Type |
---|---|
localization | object |
1<MuiPhoneInput 2 onlyCountries=['de', 'es'] 3 localization={{'Germany': 'Deutschland', 'Spain': 'España'}} 4/>
onChange | onFocus | onBlur | onClick | onKeyDown |
Country data object not returns from onKeyDown event
Data | Type | Description |
---|---|---|
value/event | string/object | the event or the phone number |
country data | object | the country object { name, dialCode, country code (iso2 format) } |
Based on react-phone-input-2
Based on react-phone-input using MIT
No vulnerabilities found.
No security vulnerabilities found.