Skip to content
Forms

Phone Input

International phone field with a country selector, emitting E.164.

Import

tsx
import { PhoneInput } from "@cooud-ui/ui";
bash
npx cooud-ui add phone-input

Examples

API Reference

Generated from the component's exported types.

PhoneInputProps

Extends Omit< InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "type" >

PropTypeDefaultDescription
value
stringControlled value as an E.164 string (e.g. `"+5511987654321"`). Pair with `onChange`.
defaultValue
stringInitial E.164 (or bare national) value for uncontrolled usage.
onChange
(value: string) => voidCalled with the full E.164 string on every edit; empty string when no number is entered.
defaultCountry
string"BR"ISO 3166-1 alpha-2 code selected on first render. Defaults to `"BR"`.
countries
PhoneCountry[]DEFAULT_PHONE_COUNTRIESOverrides the built-in country list. Order controls the list order.
invalid
booleanfalseMarks the field invalid (red border/ring + `aria-invalid`).
searchPlaceholder
string"Search country…"Placeholder for the country search box inside the selector.
emptyText
string"No country found."Message shown when no country matches the search.
label
string"Phone number"Accessible name for the whole control and the number field. Defaults to `"Phone number"`.
countryLabel
string"Select country"Accessible name for the country selector trigger. Defaults to `"Select country"`.
contentClassName
stringExtra classes for the country selector popover.
name
stringName for a hidden input carrying the E.164 value, so the field submits inside a form.