ValyroUI Русская версия

Phone Input

Phone number with country picker, live formatting and an E.164 value. Pro · Forms and input › Numbers, codes and masks

Phone number field with a searchable country picker. Formats as you type, accepts pasted international numbers, and reports the number in E.164. name submits the E.164 value.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add phone-input
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { PhoneInput } from 'valyro-ui-pro';

Props

PropTypeDefault
valuestringNumber in E.164 (+14155550132); empty string when empty.
defaultValuestring''Initial value when uncontrolled.
onValueChange(value: string, details: PhoneInputDetails) => voidCalled with the new value when it changes.
countrystringSelected country (ISO code). A pasted or controlled international number switches it.
defaultCountrystring'US'Country before anything is typed (default US).
onCountryChange(country: string) => voidCalled with the new country when it changes.
countriesstring[]ISO codes to offer (default: the ~30 built-in countries).
size'sm' | 'md' | 'lg''md'Field height and text size, country button included.
invalidbooleanfalseError border and aria-invalid on the number input (an explicit aria-invalid wins). A number too long for the selected country gets them on its own.
localestringLanguage of country names (default: the ThemeProvider's, then the browser's).
labelsPartial<PhoneInputLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: OTP Input · Next: Masked Input · All Forms and input