dentil

Phone Input

PhoneInput formats as you type and returns E.164, which most SMS and auth APIs expect. Pick a country from the flag, then type a local number to see the result.

@dentil/phone-input
On this page
Result: —

Installation

pnpm dlx shadcn@latest add @dentil/phone-input
npx shadcn@latest add @dentil/phone-input
yarn dlx shadcn@latest add @dentil/phone-input
bunx --bun shadcn@latest add @dentil/phone-input

Files land in components/dentil/phone-input/. Wraps react-phone-number-input with the stock shadcn input and a flag country picker.

API reference

PhoneInput

PropTypeDefaultDescription
valuestring | null | undefined—E.164 number, e.g. +447700900123.
onChange(value: string) => void—Called with the E.164 number as you type, or '' when cleared.
defaultCountryPhoneCountry—Country preselected while the field is empty.
countriesPhoneCountry[]—Only list these countries.
placeholderstring'Enter phone number'Number field placeholder.
…propsComponentProps<'input'>—Other props (id, aria-invalid, aria-describedby, onBlur…) are passed to the number input.