Bind value to receive the exact E.164 string and bind valid for reactive UI state. Use onValueChange when a value change should trigger a side effect. Pass countries={['UNITED_STATES']} to accept only complete U.S. numbers such as +15404441234; +1540 remains invalid. Multiple common countries can be allowed in the same array, and any ISO country code is supported. With no countries, any valid international number is accepted. Validation uses international numbering-plan metadata, and the field is composed from the Shadcn Input primitive. The component renders no label or helper copy; it only shows the error when a non-empty value is invalid.
API reference
Prop
Type
Default
Description
value
string (bindable)
''
The current controlled value.
valid
boolean (bindable)
false
Whether the current value passes validation.
countries
PhoneCountry[] (common names or ISO codes)
[] (generic E.164)
Countries whose phone-number formats are accepted.
error
string
Enter a valid phone number, such as +15404441234.
SvelteKit error object whose message is displayed.
onValueChange
(value: string, valid: boolean) => void
—
Called whenever the controlled value changes.
required
boolean
false
Marks the underlying form control as required.
class
string
—
Tailwind CSS classes applied to the component root.
inputClass
string
—
Tailwind CSS classes applied to the input.
Source
These files are included in the registry item and copied into the consuming project.