042
A phone number field with a searchable country picker: it formats the number the local way as you type, drops the habitual leading zero, and spots the country when you paste a +44.
akaphone input·phone number·tel input
Run this in any project set up for the shadcn CLI. It copies the Phone Field source into your components folder, so the code is yours to change.
npx shadcn@latest add https://devl.dev/r/phone-field.jsonImport it and render it. Every prop has a typed default, so it works straight away, and you pass your own data when you’re ready.
import { PhoneField } from "@/components/phone-field";
export default function Page() {
return <PhoneField />;
}A free React component in the Forms collection, written in TypeScript with Tailwind CSS on coss ui. MIT licensed.
Read from the Phone Field source. Everything is optional unless it says required.
| Prop | Type | Default |
|---|---|---|
| defaultCountry | string | "GB" |
| onValueChange | (value: PhoneValue) => void | — |
| countries | Country[] | COUNTRIES |
| label | string | "Phone number" |
| className | string | — |