Input
Phone Input
NewA phone field with a searchable country picker, a flag and dial code, and a number that groups itself as you type.
npx motionsnack add phone-inputCustomize
<PhoneInput />Props
22 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled national digits. Leave undefined to let the component manage them. |
| defaultValue | string | '' | National digits on first render when uncontrolled. |
| onChange | (value: { country, national, e164 }) => void | - | Called with the country code, the national digits and the full E.164 number on every change. |
| name | string | - | Name of a hidden input that submits the E.164 number with a form. |
| errorColor | string | undefined | Error colour for both themes. Undefined uses the per-theme pair (#dc2626 light, #ef4444 dark). |
| countryLabel | string | 'Country, {country} +{dial}' | Name of the country button. |
| countriesLabel | string | 'Countries' | Name of the country list. |
| emptyText | string | 'No match' | Row shown when the search matches no country. |
| locale | string | 'en-US' | Locale that sorts the country list. |
| id | string | generated | Id of the input. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Phone' | Label above the field. Empty hides it. |
| defaultCountry | 'CZ' | 'SK' | 'DE' | 'AT' | 'PL' | 'HU' | 'GB' | 'IE' | 'FR' | 'IT' | 'ES' | 'NL' | 'US' | 'CA' | 'CZ' | Country picked on first render. |
| countries | string | '' | Comma-separated ISO codes that limit the list, e.g. CZ, SK, DE. Empty offers every country. |
| placeholder | string | '' | Hint inside the empty field. Empty derives one from the country's number pattern. |
| searchPlaceholder | string | 'Search country' | Hint in the search field of the country list. |
| helperText | string | 'We only call about your project.' | Small text under the field. Empty hides it. |
| error | string | '' | Error message. Any text switches the field to its error state. |
| required | boolean | false | Marks the field as required. |
| disabled | boolean | false | Disables the field. |
| height | number | 48 | Height of the field (48, or 40 compact). |
| radius | number | 12 | Corner radius of the field. |
About Phone Input
Phone Input is for contact and booking forms that need a callable number. The button on the left shows the country's flag and dial code and opens a list of countries you can search by name, code or dial code and move through with the arrow keys. As the visitor types, the number groups itself by the country's own pattern, such as 777 123 456 for Czechia or (555) 123-4567 for the United States, and a pasted international number drops its dial code. onChange returns the country, the national digits and the full E.164 number, and a hidden input submits that number with a form. The list can be limited to a few countries, and the whole field shows the library's clear focus outline.
What's included
- Searchable country list with flags and dial codes
- Number grouped per country as you type
- E.164 value for forms and APIs
- Paste-friendly international numbers
- Keyboard navigation and Escape to close
- Helper text, required and error states
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add phone-input