Pho Design System

Phone Input

A phone number field with a searchable country picker and a national-number input on a shared Input Group surface. Built on libphonenumber-js for as-you-type formatting; the committed value is always E.164 (+14155550123).

Import

import { PhoneInput } from "@photon-ai/pho-ui/components/phone-input";

Anatomy

The left addon is a Combobox trigger showing the country flag and calling code (+1). Opening it reveals a search field that matches country name (English + the user’s locale), calling code (86 / +86), ISO alpha-2 (CN), and alpha-3 (CHN). Flags come from country-flag-icons. The right control is a type="tel" input that formats as you type.

const [phone, setPhone] = useState("");
const [valid, setValid] = useState(false);

<PhoneInput
  label="Phone number"
  value={phone}
  onValueChange={(value, { isValid }) => {
    setPhone(value);
    setValid(isValid);
  }}
/>;

Sizes

Same three sizes as Input / Input Groupsm, md, lg.

<PhoneInput size="sm" label="Small" />
<PhoneInput size="md" label="Medium" />
<PhoneInput size="lg" label="Large" />

Default country

defaultCountry sets the starting country when the value has none. Defaults to "US". Pasting a full international number (starting with +) updates the country automatically.

<PhoneInput defaultCountry="GB" label="UK number" />

Props