Migrating from ghl-ui Input to HighRise Input
This guide will help you migrate from the ghl-ui Input text component to the new HighRise Input text component.
Component Implementation Changes
Import Changes
diff
- import { UIInput, UIInputGroup, UIInputGroupLabel } from '@gohighlevel/ghl-ui'
+ import { HLInput, HLInputGroup, HLInputGroupLabel, HLFormItem } from '@platform-ui/highrise'
Basic Usage Changes
diff
- <UIInput
- id="my-input"
- v-model="inputValue"
- :modelValue="inputValue"
- placeholder="Enter text"
- />
+ <HLInput
+ id="my-input"
+ v-model:modelValue="inputValue"
+ placeholder="Enter text"
+ size="md"
+ />
diff
- <UIInput
- id="my-input"
- :modelValue="inputValue"
- @update:modelValue="handleValueChange"
- placeholder="Enter text"
- />
+ <HLInput
+ id="my-input"
+ :modelValue="inputValue"
+ @update:modelValue="handleValueChange"
+ placeholder="Enter text"
+ size="md"
+ />
INFO
- when
:modelValue
is used,@update:modelValue
is needed. - when
v-model:modelValue
is used,@update:modelValue
is not needed.
Important Size Migration Note:
- If the original
UIInput
has nosize
prop specified (using default size), always setsize="md"
on the newHLInput
- If the original
UIInput
has a specific size prop, refer to the Size Mapping section below for the correct mapping
Form Integration Changes
diff
- <UIForm :model="formModel">
- <UIFormItem label="Username">
- <UIInput
- id="username"
- v-model="username"
- placeholder="Enter your username"
- />
- </UIFormItem>
- </UIForm>
+ <HLForm :model="formModel" :rules="rules">
+ <HLFormItem
+ label="Username"
+ path="username"
+ required
+ >
+ <HLInput
+ id="username"
+ v-model:modelValue="username"
+ placeholder="Enter your username"
+ size="md"
+ />
+ </HLFormItem>
+ </HLForm>
Input Group Changes
diff
- <UIInputGroup>
- <UIInputGroupLabel>https://</UIInputGroupLabel>
- <UIInput
- id="website"
- v-model="website"
- />
- <UIInputGroupLabel>.com</UIInputGroupLabel>
- </UIInputGroup>
+ <HLInputGroup>
+ <HLInputGroupLabel>https://</HLInputGroupLabel>
+ <HLInput
+ id="website"
+ v-model:modelValue="website"
+ size="md"
+ />
+ <HLInputGroupLabel>.com</HLInputGroupLabel>
+ </HLInputGroup>
Input with prefix icon
diff
- <UIInput :modelValue="website" @update:modelValue="handleValueChange">
- <template #prefix>
- <UserIcon class="w-5 h-5" />
- </template>
- </UIInput>
+ <HLInput
+ :prefix-icon="UserIcon"
+ size="md"
+ :modelValue="website"
+ @update:modelValue="handleValueChange"
+ />
// Or using slots
+ <HLInput size="md" :modelValue="website" @update:modelValue="handleValueChange">
+ <template #prefix>
+ <UserIcon class="w-3" />
+ </template>
+ </HLInput>
Input with suffix icon
diff
- <UIInput :modelValue="website" @update:modelValue="handleValueChange">
- <template #suffix>
- <UserIcon class="w-5 h-5" />
- </template>
- </UIInput>
+ <HLInput
+ :suffix-icon="UserIcon"
+ size="md"
+ :modelValue="website"
+ @update:modelValue="handleValueChange"
+ />
// Or using slots
+ <HLInput size="md" :modelValue="website" @update:modelValue="handleValueChange">
+ <template #suffix>
+ <UserIcon class="w-3" />
+ </template>
+ </HLInput>
Password Input
diff
- <UIInput
- :modelValue="password"
- @update:modelValue="handlePasswordChange"
- type="password"
- showPasswordOn="click"
- >
- <template #password-visible-icon>
- <EyeIcon class="w-5 h-5" />
- </template>
- <template #password-invisible-icon>
- <EyeOffIcon class="w-5 h-5" />
- </template>
- </UIInput>
+ <HLInput
+ :modelValue="password"
+ @update:modelValue="handlePasswordChange"
+ type="password"
+ showPasswordOn="click"
+ size="md"
+ />
Props Changes
ghl-ui Prop | HighRise Prop | Notes |
---|---|---|
modelValue | modelValue | Use v-model:modelValue instead of v-model |
size | size | Values changed (see below) |
Type Changes
diff
- type="text" // Supported
+ type="text" // Supported
- type="textarea" // Supported
+ type="textarea" // Supported
- type="password" // Supported
+ type="password" // Supported
- type="tel" // Supported
+ type="tel" // Supported
- type="email" // Supported
+ type="email" // Supported
- type="url" // Supported
+ type="url" // Supported
Size Mapping
diff
- size="tiny" → + size="3xs"
- size="small" → + size="2xs"
- size="medium" → + size="sm"
- size="large" → + size="md"
+ size="xs" // New in HighRise
+ size="2xs" // New in HighRise
+ size="3xs" // New in HighRise
New Features in HighRise
Text Alignment
vue
<template>
<HLInput v-model:modelValue="value" text-align="start" />
<HLInput v-model:modelValue="value" text-align="center" />
<HLInput v-model:modelValue="value" text-align="end" />
</template>
Inline Editing
vue
<template>
<HLInput v-model:modelValue="value" inline :showInlineCTA="true" :showInlineBottomBorder="false" placeholder="Click to edit..." />
</template>
Icon with Tooltip
vue
<template>
<HLInput v-model:modelValue="value" :suffix-icon="HelpCircleIcon" suffix-icon-tooltip-content="Help text here" />
</template>
Character Count and Limit
vue
<template>
<!-- Basic character count -->
<HLInput v-model:modelValue="value" showCount />
<!-- With character limit -->
<HLInput v-model:modelValue="value" :maxlength="10" showCount />
</template>
Payment Input Example
vue
<template>
<HLInput v-model:modelValue="value">
<template #prefix>
<div class="flex items-center" :style="{ width: '40px', height: '40px' }">
<img
src="https://download.logo.wine/logo/Mastercard/Mastercard-Logo.wine.png"
alt="credit card"
class="w-full h-full object-contain"
/>
</div>
</template>
</HLInput>
</template>
Best Practices
- Always provide unique
id
props for accessibility - Use
v-model:modelValue
for two-way binding - Implement proper form validation when needed
- Use appropriate size variants for different contexts
- Consider mobile responsiveness
- Add proper ARIA labels for accessibility
- Handle loading and error states appropriately
- Use descriptive placeholders
- Group related inputs using
HLInputGroup
- Maintain consistent styling with other form components
- Use character count and limits for text inputs when appropriate
- Consider using inline editing for better UX in certain contexts
- Utilize tooltips for additional context or help text
- Implement proper validation feedback
Additional Notes
- The component automatically handles focus states
- Error states are managed through form validation
- Supports keyboard navigation
- Maintains consistent styling with other form components
- Handles disabled states consistently
- Integrates seamlessly with form validation
- Maintains accessibility standards
- Supports custom styling through CSS variables
- Provides built-in support for character counting and limiting
- Offers flexible icon integration options
- Supports inline editing mode for better UX
- Includes tooltip support for additional context