Skip to content
Star

PxPhoneInput

An international phone number input with country code selector, built on vue-tel-input. Validation runs through vee-validate — the component wraps its input in a <Field> and requires a name prop.

No built-in label

The component doesn't render a label itself. Pair it with PxLabel if you need one, as shown below.

Usage

Demo
Value: None

Required Field

Pass a rules string/object understood by vee-validate — "required" marks the field mandatory:

vue
<PxPhoneInput v-model="phone" name="phone" rules="required" />

Props

PropTypeDefaultDescription
modelValuestring''Phone number value. Use with v-model.
namerequiredstringField name registered with vee-validate — required for validation to work.
rulesstring | Record<string, unknown> | ((value: unknown) => boolean | string)''vee-validate rules, e.g. 'required'.
disabledbooleanfalseDisables the input.

Emits

EventPayloadDescription
update:modelValuestringEmitted on input change.

Built with VitePress