Skip to content

Phone Input

Form

International phone number input with country code selector and formatting.

Country selectionAs-you-type formatting
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

Usage

Keep the formatted display value in state. defaultCountry initializes the country selector; it is not a controlled country prop. Validate and normalize the number before storing it on a backend.

Import
import { PhoneInput } from "@dashboardpack/core/components/ui/phone-input";

Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.

API reference

Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.

Phone Input props
PropType / DefaultDescription
valuestring

Default: required

Formatted input value.
onChange(value: string) => void

Default: required

Receives formatted text.
defaultCountryCountryCode

Default: US

Initial country, using a two-letter code.
placeholderstring

Default: Phone number

Empty input hint.
disabledboolean

Default: false

Disable input and country selection.

Build with these too