Phone Input
Conforms user input to a pre-defined phone number pattern.
Examples
NATP Phone Input
Accepts phone numbers formated for NATP (North American Telephone Plan). This is the default.
<PhoneInput />
International PhoneInput
Accepts phone numbers formated for international numbers with country codes.
<PhoneInput />
Props
| Name | Type | Default Value | Required | Description |
|---|---|---|---|---|
fieldClassName | string | No | A className to apply to the field. | |
fieldProps | Record<string, unknown> | No | Any props to spread onto the field container. | |
format | PhoneInputFormat | "nanp" | "intl" | PhoneInputFormat.NANP (North American Numbering Plan) | No | The format to use for the phone number. |
helperText | ReactNode | No | A string or component to display as helper text beneath the input | |
iconEnd | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | null | No | An icon to render at the end of the input. | |
iconStart | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | null | No | An icon to render at the front of the input. | |
label | ReactNode | No | A string or component to display as a label above the input | |
multiline | boolean | false | No | Should a textarea be used instead of an input? |
onChange | FormControlChangeEventHandler<InputType, string | number | readonly string[] | (string | number | readonly string[])[]> | undefined | No | Emit a new value when the input's selected value changes. | |
required | boolean | false | No | Is the field required? |
resize | boolean | false | No | Can the textarea be resized? |
rows | string | number | No | How many rows call should the multiline input be? | |
size | undefined | FormControlSize.Medium | No | The size of the field |
state | "" | FormControlState | "critical" | "warning" | "success" | FormControlState.Default | No | The state of the field |