Migrating from ghl-ui InputPhone to HighRise InputPhone
This guide will help you migrate from the ghl-ui InputPhone component to the new HighRise InputPhone component.
Component Implementation Changes
Import Changes
diff
- import { UIInputPhone } from '@gohighlevel/ghl-ui'
+ import { HLInputPhone } from '@platform-ui/highrise'Basic Usage Changes
diff
- <UIInputPhone
- id="phone-input"
- v-model:value="phoneNumber"
- v-model:countryCode="countryCode"
- @isValid="isPhoneValid = $event"
- @nationalFormat="nationalFormat = $event"
- @internationalFormat="internationalFormat = $event"
- />
-
+ <HLInputPhone
+ id="phone-input"
+ v-model:value="phoneNumber"
+ v-model:countryCode="countryCode"
+ @isValid="isPhoneValid = $event"
+ @nationalFormat="nationalFormat = $event"
+ @internationalFormat="internationalFormat = $event"
+ />Form Integration Changes
diff
- <UIForm :model="formData" :rules="rules">
- <UIFormItem label="Phone Number" path="phone">
- <UIInputPhone
- id="form-phone"
- v-model:value="formData.phone"
- v-model:countryCode="formData.countryCode"
- @isValid="handlePhoneValidation"
- />
- </UIFormItem>
- </UIForm>
-
+ <HLForm :model="formData" :rules="rules">
+ <HLFormItem label="Phone Number" path="phone" required>
+ <HLInputPhone
+ id="form-phone"
+ v-model:value="formData.phone"
+ v-model:countryCode="formData.countryCode"
+ @isValid="handlePhoneValidation"
+ />
+ </HLFormItem>
+ </HLForm>Props Changes
Required & Renamed
| ghl-ui Prop | HighRise Prop | Notes |
|---|---|---|
id | id | Still required |
value | value | Use v-model:value; emits update:value with formatted value |
countryCode | countryCode | Use v-model:countryCode; emits update:countryCode |
Additional HighRise Props
| Prop | Type | Default | Description |
|---|---|---|---|
format | 'national' | 'international' | 'national' | Formatting style for emitted value |
disableCountryPicker | boolean | false | Lock country selector |
dropdownHeight | string | '32rem' | Height of country dropdown |
size | HLInputSize | inherits form | Input size |
inline | boolean | false | Render inline styling |
showInlineCTA | boolean | false | Show inline confirm/cancel affordance |
showInlineBottomBorder | boolean | true | Control inline bottom border |
showSavedIcon | boolean | false | Show saved-state icon |
clearable | boolean | true | Allow clearing the value |
autocomplete | boolean | false | Apply autocomplete="tel" when true |
fontSize | string | var token | Typography override |
fontWeight | string | var token | Typography override |
Events
update:value(formatted based onformat)update:countryCodeinternationalFormatnationalFormatisValidconfirm,cancel,blur,focus,keydown
Examples
Basic Usage
vue
<template>
<HLInputPhone
id="basic-phone"
v-model:value="phoneNumber"
v-model:countryCode="countryCode"
placeholder="Enter phone number"
@isValid="isPhoneValid = $event"
@internationalFormat="intl = $event"
@nationalFormat="natl = $event"
/>
</template>
<script setup>
import { ref } from 'vue'
import { HLInputPhone } from '@platform-ui/highrise'
const phoneNumber = ref('')
const countryCode = ref('US')
const isPhoneValid = ref(false)
const intl = ref('')
const natl = ref('')
</script>With Validation
vue
<template>
<HLForm :model="formData" :rules="rules">
<HLFormItem label="Phone Number" path="phone" required>
<HLInputPhone
id="validated-phone"
v-model:value="formData.phone"
v-model:countryCode="formData.countryCode"
:format="'international'"
@isValid="val => (formData.isPhoneValid = val)"
/>
</HLFormItem>
</HLForm>
</template>
<script setup>
import { reactive } from 'vue'
import { HLForm, HLFormItem, HLInputPhone } from '@platform-ui/highrise'
const formData = reactive({
phone: '',
countryCode: 'US',
isPhoneValid: false,
})
const rules = {
phone: {
required: true,
validator: () => {
if (!formData.isPhoneValid) return new Error('Please enter a valid phone number')
},
trigger: ['blur', 'input'],
},
}
</script>Inline Styling Variant
vue
<template>
<HLInputPhone
id="inline-phone"
v-model:value="phoneNumber"
v-model:countryCode="countryCode"
inline
:show-inline-c-t-a="true"
:show-inline-bottom-border="false"
:show-saved-icon="true"
:clearable="false"
/>
</template>
<script setup>
import { ref } from 'vue'
import { HLInputPhone } from '@platform-ui/highrise'
const phoneNumber = ref('')
const countryCode = ref('US')
</script>Best Practices
- Always provide
id; the component requires it. - Use
v-model:valuefor the formatted number andv-model:countryCodeto stay in sync with the selector. - Pick
format="international"when storing values for global audiences; usenationalfor local display only. - Disable the picker with
disable-country-pickerwhen country changes are not allowed. - Rely on
@isValidplus form rules for validation feedback; the component emits validity for every change. - Turn off
clearablewhen the value should only be edited intentionally (e.g., in inline review modes). - Use
autocompletewhen you want the browser to suggest stored phone numbers. - Keep dropdown height reasonable (
dropdown-height) to avoid scroll jank on shorter viewports.
Additional Notes
- Emitted
update:valueis already formatted according to the current country andformatsetting. - The component inherits size from parent
HLFormItem/HLInputGroupwhensizeis not provided. - Prefix uses the country picker by default; set
disable-country-pickerto lock it. - All other DOM attributes are applied to the underlying
HLInputviav-bind="$attrs"in the component.