Command Palette

Search for a command to run...

Phone Input

Phone Input allows user to enter phone number in E.164 format.

Installation

pnpm dlx shadcn@latest add https://ui-x.junwen-k.dev/r/phone-input.json

Usage

import { PhoneInput } from "@/components/ui/phone-input";
<PhoneInput>
  <PhoneInputCountrySelect>
    <PhoneInputCountrySelectTrigger>
      <PhoneInputCountrySelectValue />
    </PhoneInputCountrySelectTrigger>
    <PhoneInputCountrySelectContent>
      <PhoneInputCountrySelectOptions />
    </PhoneInputCountrySelectContent>
  </PhoneInputCountrySelect>
  <PhoneInputInput />
</PhoneInput>

Examples

Default

Separated

Preferred country has been set to MY (Malaysia).

National format (default):
012-345 6789
International format:
+60 12 345 6789

Combobox

Form

You can use parsePhoneNumber to retrieve additional information about the phone number, such as country, national number, and more.

Your phone number is used to contact you.