Pro
Phone field
A phone number field with a country picker, formatting and validity.
pnpm dlx shadcn@latest add @caliper/phone-fieldWhen to use
Use it for
- Sign-up and contact forms that need international numbers.
- You want formatting as people type and a valid flag.
Skip it when
- You only collect numbers for one country; a plain input with a pattern is lighter.
Installation
pnpm dlx shadcn@latest add @caliper/phone-field
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UIβs tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from PhoneField and parsePhone.
import { PhoneField, parsePhone, phoneCountries } from "@/components/ui/phone-field"
The worked example comes with Pro
The 24-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
PhoneField
component
parsePhone
component
No props of its own; it accepts the native props of its root element.
phoneCountries
helper
A helper exported alongside the component, not a component.
Accessibility
It exposes listbox and option semantics, with aria-label, aria-expanded, aria-controls, aria-hidden, aria-invalid and aria-describedby kept in step with state.
Motion
Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.