remold/ui

Phone input

A phone number field that formats as you type: each digit rises into place, the country's spaces and brackets appear as the number reaches them, and changing country regroups the same digits with the separators sliding to their new places.

Base UIMotion

Ghana · enter your national number. For example, 24 412 3456.

Things to try

  • Type a number. Spaces appear as the number reaches them.
  • Search countries. Search by name, country abbreviation, or dialing code across the ten example countries.
  • Change the country. The same digits regroup into the new format when the input is not focused. Extra digits are preserved and a length hint appears.
  • Paste a full number. A pasted country code or leading zero is dropped.

Install

npx shadcn@latest add https://your-docs-site/r/phone-input.json

Dependencies

The install command adds these for you. If you copy the code by hand, install them yourself.

npm install @base-ui/react @hugeicons/core-free-icons @hugeicons/react @remold-ui/react motion

How it works

  • Built on Base UI. Field gives the label and description, and Combobox provides the searchable country picker.
  • Native editing. The real input is visible while focused, supporting caret placement, selection, and deletion. The formatted animated preview returns on blur.
  • Separators slide. Digits are keyed by their position and separators by their order, so a space shared by both formats moves instead of being redrawn.
Formats are simplified examples, not full numbering plans.

On this page