mui-outlined-phone-input
Version:
A phone number input component for React mimicking the MUI outlined input
72 lines (57 loc) • 2.98 kB
Markdown
[![Npm Version][npm-version-image]][npm-version-url]
[![Downloads][downloads-image]][downloads-url]
[![License][license-image]][license-url]
- Phone number input for React with corresponding country picker
- Styled to match @mui-material outlined textfield
<br>
**Table of Contents**
- [Installation](
- [Basic Example](
- [Props](
<a id="item-one"></a>
```
npm install mui-outlined-phone-input
```
```
yarn add mui-outlined-phone-input
```
<a id="item-two"></a>
```js
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>
)
}
```
<br />
<a id="item-three"></a>
| 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 |
<br />
[]: https://img.shields.io/npm/l/mui-outlined-phone-input.svg?color=%23498af2
[]: LICENSE
[]: http://img.shields.io/npm/dm/mui-outlined-phone-input.svg?color=%23498af2
[]: http://npm-stat.com/charts.html?package=mui-outlined-phone-input
[]: https://img.shields.io/npm/v/mui-outlined-phone-input.svg?color=%23498af2
[]: https://www.npmjs.com/package/mui-outlined-phone-input