Skip to main content

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.

import { PhoneInput } from '@curology/ui-components-web/react/PhoneInput';

<PhoneInput />

International Phone Input

Accepts phone numbers formated for international numbers with country codes.

import { PhoneInput } from '@curology/ui-components-web/react/PhoneInput';

<PhoneInput format="intl" />

Controlled Phone Input

Like all form inputs, a PhoneInput can either be uncontrolled, or controlled (by providing a value and onChange listener).

import { PhoneInput } from '@curology/ui-components-web/react/PhoneInput';

<PhoneInput
...
value={someValue}
onChange={(evt, value) => ...}
/>

Props

PhoneInputProps

NameTypeDefault ValueRequiredDescription
All attributes of a <input />
fieldClassNamestringNoA className to apply to the field.
fieldPropsRecord<string, unknown>NoAny props to spread onto the field container.
format"nanp" | "intl"PhoneInputFormat.NANP (North American Numbering Plan)NoThe format to use for the phone number.
helperTextReactNodeNoA string or component to display as helper text beneath the input
highlightReactNodeNoHighlighted helper text to display at the bottom of the multiline text input
highlightClassNamestringNoA className to apply to the highlight.
iconEndComponentClass<any, any> | FunctionComponent<any> | ReactElement<any, string | JSXElementConstructor<any>> | ForwardRefExoticComponent<any>NoAn icon to render at the end of the input.
iconStartComponentClass<any, any> | FunctionComponent<any> | ReactElement<any, string | JSXElementConstructor<any>> | ForwardRefExoticComponent<any>NoAn icon to render at the front of the input.
labelReactNodeNoA string or component to display as a label above the input
multilinefalse | truefalseNoShould a textarea be used instead of an input?
onChangeFormControlChangeEventHandlerNoEmit a new value when the input's selected value changes.
resizefalse | truefalseNoCan the textarea be resized?
rowsstring | numberNoHow many rows call should the multiline input be?
state"" | "critical" | "warning" | "success"''NoThe state of the field