Skip to content

Phone Input ​

Shared label and supporting-text behaviour is summarised on Inputs overview.

catnip-input-phone ​

Props ​

Value & country selection ​

PropTypeDefaultOptionsDescription
modelValueCatnipInputPhoneModelValuenull—Phone value; countryCode is the dial prefix (e.g. "+47"), and countryIsoCode disambiguates countries sharing a prefix.
defaultCountryCodestring"auto"ISO code, dial prefix, or autoCountry used when modelValue.countryIsoCode is absent. auto uses browser locale, then NO.
placeholderstring""—Placeholder for the phone-number text field.
autocompletestring"tel"—Native autocomplete on the telephone input.
showClearButtonbooleanfalse—Shows a clear control when a phone number is present.

Country list ​

PropTypeDefaultOptionsDescription
openboolean——Controlled open state for the country picker. Pair with open-change.
filterValuestring——Controlled search text for the country picker.
filterPlaceholderstring""—Search placeholder; defaults to bundled locale copy.
listMaxHeightstring | number"280px"—Max height for the scrollable country list body.

Field presentation ​

PropTypeDefaultOptionsDescription
labelstring""—Visible field label when the label slot is empty.
optionalbooleanfalse—When true and not required, shows the localized optional hint.
optionalTextstring""—Overrides the localized optional hint (HTML: optional-text).
infostring""—Info tooltip beside the label; when non-empty, it wins over the label.suffix slot.
alignment"left" | "center" | "right""left"left, center, rightHorizontal alignment of the field label block.
requiredMarkerstring"*"—Visual marker for required fields (HTML: required-marker).
requiredScreenReaderTextstring""—Optional screen-reader supplement; it does not replace required on the control (HTML: required-screen-reader-text).
supportingTextSupportingTextProp""—One or more helper or validation messages. Each object requires text; intent accepts neutral, danger, warning, or success, and icon accepts a Catnip icon name. See supporting-text examples.

State ​

PropTypeDefaultOptionsDescription
size"s" | "m" | "l""m"s, m, lDimensions and typography.
intent"neutral" | "danger" | "warning" | "success""neutral"neutral, danger, warning, successSemantic state applied to field and supporting-text styling; danger sets aria-invalid on the telephone input.
disabledbooleanfalse—Disables the country picker and telephone input. Disabled styling takes priority when readonly is also set.
readonlybooleanfalse—Makes the control read-only and prevents country-picker changes.
requiredbooleanfalse—Native required on the telephone input and label marker.
inputPhoneAriaLabelstring""—aria-label for the telephone input when there is no visible label.
ariaDescribedbystring""—IDs of elements in the page, or in the shadow root the element sits in, that describe the field. They're resolved there and connected to the inner control by element reflection, read before the supporting text.

Advanced ​

PropTypeDefaultOptionsDescription
inputPhoneIdstring""—DOM id for the telephone input.
namestring""—Native form name on the form-associated CE.
inputPhoneAutofocusbooleanfalse—Forwards native autofocus to the telephone input; use sparingly.
hideLabelbooleanfalse—Hides the built-in label row.
clearButtonAriaLabelstring""—Accessible label for clear; defaults to bundled locale copy.
countryButtonAriaLabelstring""—Accessible label for the country picker button/list.
testSelectorsTestSelectorsPropSee Test selectors—Overrides stable data-test values.

Events ​

NamePayloadDescription
update:modelValue{ countryCode: string; countryIsoCode: string; phoneNumber: string } | nullValue changed.
open-changebooleanCountry picker open state changed. Not emitted when the state doesn't change. Use @open-change.
update:filterValuestringCountry search text changed.
close—The country picker closed, for any reason: a pick, Escape, a press outside, Tab, or focus moving elsewhere.

Slots ​

NameDescription
labelCustom label content; falls back to label prop.
label.actionTrailing action in the label row (e.g. link).
label.suffixCustom label suffix (suffix slot); used only when info is empty.

Test selectors ​

AttributeDefaultApplies to
rootcatnip-input-phoneField wrapper
controlcatnip-input-phone-controlNative telephone input
countryButtoncatnip-input-phone-country-buttonCountry picker button
countryFlagcatnip-input-phone-country-flagTrigger/list flag
countryDialCodecatnip-input-phone-country-dial-codeCountry list dial code
chevroncatnip-input-phone-chevronCountry picker chevron
clearButtoncatnip-input-phone-clearClear control
supportingTextcatnip-input-phone-supporting-textSupporting message
floatingPanel{ root: "catnip-floating-panel" }Floating country panel
list{ root, header, body, footer }Internal country list
filterInput{ root, control, icon }Search row
optioncatnip-input-phone-optionCountry list row

Catnip Design System by Signicat