- Phone number input for React with corresponding country picker
- Styled to match @mui-material outlined textfield
Table of Contents
npm install mui-outlined-phone-input
yarn add mui-outlined-phone-input
import { Input as PhoneInput } from 'mui-outlined-phone-input';
import { useState } from 'react';
const Form = () => {
const [phone, setPhone] = useState('+15045555555');
return (
<div>
<PhoneInput
value={phone ?? ''}
onChange={(e: { target: { value: string } }) => setPhone(e?.target?.value ?? '')}
/>
</div>
)
}
Name | Type | Default | Description |
---|---|---|---|
value | string |
'' | The initial and or current value |
onChange | function |
() => {} | A function to update inputs value |
label | string |
'Phone number' | (optional) The inputs label |
palceholder | string |
'(504) 555-5555' | (optional) The inputs placeholder |
error | boolean |
false | (optional) Whether or not to show the input in error state |
helperText | string |
'' | (optional) Inputs helperText |
className | string |
'' | (optional) Classes to apply to the input |
wrapperClassName | string |
'' | (optional) Classes to apply to the inputs wrapper |
disabled | boolean |
false | (optional) Whether or not to disabled the input |