Migrating from ghl-ui Radio to HighRise Radio
This guide will help you migrate from the ghl-ui Radio component to the new HighRise Radio component.
Component Implementation Changes
Import Changes
diff
- import { UIRadio } from '@gohighlevel/ghl-ui'
+ import { HLRadio } from '@platform-ui/highrise'
Basic Usage Changes
diff
- <UIRadio
- v-model="isChecked"
- value="option1"
- >
- Option 1
- </UIRadio>
+ <HLRadio
+ id="option1"
+ v-model="isChecked"
+ value="option1"
+ >
+ Option 1
+ </HLRadio>
Form Integration Changes
diff
- <UIForm :model="formModel">
- <UIFormItem label="Options">
- <UIRadio
- v-model="formModel.selected"
- value="option1"
- >
- Option 1
- </UIRadio>
- </UIFormItem>
- </UIForm>
+ <HLForm :model="formModel" :rules="rules">
+ <HLFormItem
+ label="Options"
+ path="selected"
+ required
+ >
+ <HLRadio
+ id="option1"
+ v-model="formModel.selected"
+ value="option1"
+ >
+ Option 1
+ </HLRadio>
+ </HLFormItem>
+ </HLForm>
Size Variants Changes
diff
- <UIRadio
- v-model="value"
- size="large"
- >
- Large Radio
- </UIRadio>
+ <HLRadio
+ id="radio-lg"
+ v-model="value"
+ size="lg"
+ >
+ Large Radio
+ </HLRadio>
Props Changes
ghl-ui Prop | HighRise Prop | Notes |
---|---|---|
size | 'lg' | 'md' | 'sm' | 'xs' | '2xs' | '3xs' | Extended size options |
onlyIcon | boolean | Shows only the radio button without label spacing |
Size Mapping
diff
- size="small" → + size="sm"
- size="medium" → + size="md"
- size="large" → + size="lg"
+ size="xs" // New in HighRise
+ size="2xs" // New in HighRise
+ size="3xs" // New in HighRise
Examples
Basic Radio
vue
<template>
<HLRadio id="basic-radio" v-model="isChecked" value="option1"> Option 1 </HLRadio>
</template>
<script setup>
import { ref } from 'vue'
import { HLRadio } from '@platform-ui/highrise'
const isChecked = ref(false)
</script>
Radio with Different Sizes
vue
<template>
<div class="space-y-4">
<HLRadio id="radio-lg" v-model="value" size="lg"> Large Radio </HLRadio>
<HLRadio id="radio-md" v-model="value" size="md"> Medium Radio </HLRadio>
<HLRadio id="radio-sm" v-model="value" size="sm"> Small Radio </HLRadio>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { HLRadio } from '@platform-ui/highrise'
const value = ref(false)
</script>
Disabled Radio
vue
<template>
<HLRadio id="disabled-radio" v-model="isChecked" value="option1" disabled> Disabled Radio </HLRadio>
</template>
<script setup>
import { ref } from 'vue'
import { HLRadio } from '@platform-ui/highrise'
const isChecked = ref(false)
</script>
Best Practices
- Always provide a unique
id
for accessibility - Use
v-model
for two-way binding - Implement proper form validation
- Use appropriate size variants
- Consider mobile responsiveness
- Add proper ARIA labels
- Handle loading states appropriately
- Use descriptive labels
- Implement proper error handling
- Consider using tooltips for additional information
- Handle disabled states properly
Additional Notes
- The component automatically handles focus states
- Error states are managed through validation status
- 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 clear visual feedback for all states
- Works well on both desktop and mobile devices
- Supports both controlled and uncontrolled modes
- Includes built-in validation support