Phone Input
Телефон с выбором страны, форматированием на лету и значением E.164. Pro · Формы и ввод › Числа, коды и маски
Установка
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';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
value | string | Number in E.164 (+14155550132); empty string when empty. | |
defaultValue | string | '' | Initial value when uncontrolled. |
onValueChange | (value: string, details: PhoneInputDetails) => void | Called with the new value when it changes. | |
country | string | Selected country (ISO code). A pasted or controlled international number switches it. | |
defaultCountry | string | 'US' | Country before anything is typed (default US). |
onCountryChange | (country: string) => void | Called with the new country when it changes. | |
countries | string[] | ISO codes to offer (default: the ~30 built-in countries). | |
size | 'sm' | 'md' | 'lg' | 'md' | Field height and text size, country button included. |
invalid | boolean | false | Error 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. |
locale | string | Language of country names (default: the ThemeProvider's, then the browser's). | |
labels | Partial<PhoneInputLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Похожие компоненты
- Number Input — Числовой ввод
- OTP Input — Ввод одноразового кода
- Masked Input — Ввод по маске: карты с Luhn, срок действия, CVC, дата, время
- Text Input — Текстовые поля
- Textarea — Многострочный ввод
- Search Input — Поисковая строка
- Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
- Tags Input — Ввод тегов
- Select — Выбор из списка
- Multi Select — Множественный выбор
- Combobox — Поиск и выбор
- Listbox — Список вариантов на странице: один или несколько, диапазоны с Shift
Назад: OTP Input · Далее: Masked Input · Весь раздел «Формы и ввод»