# Phone

> An international phone input with country detection and E.164 output.

_Updated: 2026-06-04_

An international phone input with country detection and E.164 output.

## Installation

```bash
railbase ui add phone
```

> [!NOTE]
> `railbase ui add` also copies the `button`, `command`, `input`, `popover` components — they ship alongside this component automatically.

## Usage

```tsx
import { PhoneInput } from "@/lib/ui/phone";

<PhoneInput value={phone} onChange={setPhone} />
// toE164(), isValidE164(), formatNational() helpers are exported
```

## Anatomy

Exported parts: `COUNTRIES` · `isoToFlag` · `formatNational` · `detectCountry` · `toE164` · `splitE164` · `PhoneInput` · `isValidE164`
