Skip to content
caliper ui pro docs

Phone field

A phone number field with a country picker, formatting and validity.

Pro

Valid number.

When to use

  • Sign-up and contact forms that need international numbers.
  • You want formatting as people type and a valid flag.

When not to use

  • You only collect numbers for one country; a plain input with a pattern is lighter.

Installation

terminal
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.

API reference

PhoneField

15 props
PropTypeDefault
labelstring"Phone number"
valuestringβ€”
defaultValuestring""
countrystringβ€”
defaultCountrystring"US"
countriesreadonly string[]β€”
preferredCountriesreadonly string[]["US", "GB", "IN"]
descriptionstringβ€”
disabledbooleanβ€”
requiredbooleanβ€”
namestringβ€”
idstringβ€”
onValueChange((value: string, details: PhoneDetails) => void)β€”
onCountryChange((iso: string) => void)β€”
classNamestringβ€”

parsePhone

0 props

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.

Keyboard

↓
Moves to the next item or value.
↑
Moves to the previous item or value.
Enter
Activates the focused control.
Escape
Closes or cancels, then returns focus to where it came from.

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.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/phone-field.md

The index of every part is at /llms.txt.

More in Money and phone