Migrating from ghl-ui RadioGroupItem to HighRise RadioCard
This guide will help you migrate from the ghl-ui RadioGroupItem component to the new HighRise RadioCard component.
Component Implementation Changes
Import Changes
diff
- import { UIRadioGroup, UIRadioGroupItem } from '@gohighlevel/ghl-ui'
+ import { HLRadioGroup, HLRadioCard } from '@platform-ui/highrise'Basic Usage Changes
diff
- <UIRadioGroup
- v-model:value="selectedValue"
- >
- <UIRadioGroupItem
- value="1"
- title="Basic Plan"
- description="Perfect for small businesses"
- icon="star"
- @change="handleChange"
- >
- <template #icon><LayersTwo02Icon class="w-8 h-8" /></template>
- </UIRadioGroupItem>
- <UIRadioGroupItem
- value="2"
- title="Pro Plan"
- description="Ideal for growing businesses"
- icon="star-fill"
- @change="handleChange"
- >
- <template #icon><LayersTwo02Icon class="w-8 h-8" /></template>
- </UIRadioGroupItem>
- </UIRadioGroup>
+ <HLRadioGroup
+ id="plan-group"
+ :value="selectedValue"
+ :radioCardGroup="true"
+ >
+ <HLRadioCard
+ value="1"
+ title="Basic Plan"
+ description="Perfect for small businesses"
+ icon="star"
+ @change="handleChange"
+ >
+ <template #icon><LayersTwo02Icon /></template>
+ </HLRadioCard>
+ <HLRadioCard
+ value="2"
+ title="Pro Plan"
+ description="Ideal for growing businesses"
+ icon="star-fill"
+ @change="handleChange"
+ >
+ <template #icon><LayersTwo02Icon /></template>
+ </HLRadioCard>
+ </HLRadioGroup>Form Integration Changes
diff
- <UIForm :model="formModel">
- <UIFormItem label="Select Plan">
- <UIRadioGroup
- v-model:value="formModel.plan"
- >
- <UIRadioGroupItem
- value="basic"
- title="Basic Plan"
- description="Perfect for small businesses"
- icon="star"
- >
- <template #icon><LayersTwo02Icon /></template>
- </UIRadioGroupItem>
- <UIRadioGroupItem
- value="pro"
- title="Pro Plan"
- description="Ideal for growing businesses"
- icon="star-fill"
- >
- <template #icon><LayersTwo02Icon /></template>
- </UIRadioGroupItem>
- </UIRadioGroup>
- </UIFormItem>
- </UIForm>
+ <HLForm :model="formModel" :rules="rules">
+ <HLFormItem
+ label="Select Plan"
+ path="plan"
+ required
+ >
+ <HLRadioGroup
+ id="plan-group"
+ v-model:value="formModel.plan"
+ >
+ <HLRadioCard
+ value="basic"
+ title="Basic Plan"
+ description="Perfect for small businesses"
+ icon="star"
+ @change="handleChange"
+ >
+ <template #icon><LayersTwo02Icon /></template>
+ </HLRadioCard>
+ <HLRadioCard
+ value="pro"
+ title="Pro Plan"
+ description="Ideal for growing businesses"
+ icon="star-fill"
+ @change="handleChange"
+ >
+ <template #icon><LayersTwo02Icon /></template>
+ </HLRadioCard>
+ </HLRadioGroup>
+ </HLFormItem>
+ </HLForm>Props Changes
| ghl-ui Prop | HighRise Prop | Notes |
|---|---|---|
value | value | Same binding, used with parent HLRadioGroup |
| - | id | Optional; auto-generated when omitted |
| - | title | Optional title text |
| - | description | Optional supporting text |
| - | compact | Reduces padding and hides inline radio icon |
| - | width | Number; overrides card width |
| - | iconSize | Controls icon container size (default 32px) |
| - | checked | Allows controlled checked state (in addition to group value) |
Examples
Basic RadioCard Group
vue
<template>
<HLRadioGroup id="plan-group" v-model:value="selectedValue">
<HLRadioCard value="basic" title="Basic Plan" description="Perfect for small businesses" icon="star" />
<HLRadioCard value="pro" title="Pro Plan" description="Ideal for growing businesses" icon="star-fill" />
</HLRadioGroup>
</template>
<script setup>
import { ref } from 'vue'
import { HLRadioGroup, HLRadioCard } from '@platform-ui/highrise'
const selectedValue = ref('')
</script>Compact RadioCard Group
vue
<template>
<HLRadioGroup id="compact-plan-group" v-model:value="selectedValue" :radio-card-group="true" width="equal">
<HLRadioCard value="basic" title="Basic" description="Best for starters" compact>
<template #icon><LayersTwo02Icon /></template>
</HLRadioCard>
<HLRadioCard value="pro" title="Pro" description="More controls" compact>
<template #icon><LayersTwo02Icon /></template>
</HLRadioCard>
</HLRadioGroup>
</template>
<script setup>
import { ref } from 'vue'
import { HLRadioGroup, HLRadioCard } from '@platform-ui/highrise'
import { LayersTwo02Icon } from '@gohighlevel/ghl-icons/24/outline'
const selectedValue = ref('basic')
</script>RadioCard with Custom Layout
vue
<template>
<HLForm :model="formModel">
<HLFormItem label="Select Plan" path="plan">
<div class="grid grid-cols-2 gap-4">
<HLRadioGroup id="plan-group" v-model:value="formModel.plan">
<HLRadioCard value="basic" title="Basic Plan" description="Perfect for small businesses" icon="star" />
<HLRadioCard value="pro" title="Pro Plan" description="Ideal for growing businesses" icon="star-fill" />
</HLRadioGroup>
</div>
</HLFormItem>
</HLForm>
</template>
<script setup>
import { ref } from 'vue'
import { HLForm, HLFormItem, HLRadioGroup, HLRadioCard } from '@platform-ui/highrise'
const formModel = ref({
plan: '',
})
</script>RadioCard with Disabled Options
vue
<template>
<HLForm :model="formModel">
<HLFormItem label="Select Plan" path="plan">
<HLRadioGroup id="plan-group" v-model:value="formModel.plan">
<HLRadioCard value="basic" title="Basic Plan" description="Perfect for small businesses" icon="star" />
<HLRadioCard value="pro" title="Pro Plan" description="Ideal for growing businesses" icon="star-fill" />
<HLRadioCard value="enterprise" title="Enterprise Plan" description="For large organizations" icon="star-fill" disabled />
</HLRadioGroup>
</HLFormItem>
</HLForm>
</template>
<script setup>
import { ref } from 'vue'
import { HLForm, HLFormItem, HLRadioGroup, HLRadioCard } from '@platform-ui/highrise'
const formModel = ref({
plan: '',
})
</script>Best Practices
- Always provide a unique
idfor accessibility - Use
v-model:valuefor two-way binding - Implement proper form validation
- Use appropriate size variants
- Consider mobile responsiveness
- Add proper ARIA labels
- Handle loading states appropriately
- Use descriptive titles and descriptions
- Group related options logically
- Use consistent spacing and alignment
- Implement proper error handling
- Consider using tooltips for additional information
- Handle disabled states properly
- Use appropriate layout for different screen sizes
- Choose meaningful icons that represent the options
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
- Enhanced visual presentation with icons and descriptions
- Better user experience for complex selection scenarios