Get back to home
2024-03-08

Phone input number component with Shadcn UI

This is a demo of a custom phone number component built with Shadcn UI. Feel free to play around with it and customize it to your needs.

You will need some extra packages to make this works.

npm install libphonenumber-js i18n-iso-countries react-phone-number-input

Don’t forget to register the local you want.

import { registerLocale } from "i18n-iso-countries"
// The local you want
import enCountries from "i18n-iso-countries/langs/en.json"
registerLocale(enCountries)
country: Franceindicatif: +33placeholder: +33 0 00 00 00 00value: isValid: false