ValyroUI English version

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';

Пропсы

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.

Похожие компоненты

  • 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 · Весь раздел «Формы и ввод»