Migrating from ghl-ui ButtonGroup
The ButtonGroup component from ghl-ui has been replaced with a more flexible approach using HighRise UI's HLButton components and utility classes. This guide will help you migrate your button groups to the new implementation.
Component Changes
Instead of using a dedicated ButtonGroup component, you'll now create button groups using HLButton components with appropriate utility classes.
Import Changes
diff
- import { UIButtonGroup } from '@gohighlevel/ghl-ui'
+ import { HLButton } from '@platform-ui/highrise'
Basic Usage Changes
diff
- <UIButtonGroup>
- <UIButton type="primary">Left</UIButton>
- <UIButton type="primary">Middle</UIButton>
- <UIButton type="primary">Right</UIButton>
- </UIButtonGroup>
+ <div class="hr-button-group">
+ <HLButton
+ id="left-button"
+ variant="primary"
+ class="hr-button-group__item hr-button-group__item--left"
+ >
+ Left
+ </HLButton>
+ <HLButton
+ id="middle-button"
+ variant="primary"
+ class="hr-button-group__item hr-button-group__item--middle"
+ >
+ Middle
+ </HLButton>
+ <HLButton
+ id="right-button"
+ variant="primary"
+ class="hr-button-group__item hr-button-group__item--right"
+ >
+ Right
+ </HLButton>
+ </div>
Styling
Add these utility classes to your stylesheet:
scss
.hr-button-group {
@apply flex items-center gap-0;
&__item {
&--left {
@apply rounded-r-none border-r-0;
}
&--middle {
@apply rounded-none border-r-0;
}
&--right {
@apply rounded-l-none;
}
}
}
Examples
Basic Button Group
vue
<template>
<div class="hr-button-group">
<HLButton id="view-button" variant="secondary" class="hr-button-group__item hr-button-group__item--left"> View </HLButton>
<HLButton id="edit-button" variant="secondary" class="hr-button-group__item hr-button-group__item--middle"> Edit </HLButton>
<HLButton id="delete-button" variant="secondary" class="hr-button-group__item hr-button-group__item--right"> Delete </HLButton>
</div>
</template>
<script setup>
import { HLButton } from '@platform-ui/highrise'
</script>
With Icons
vue
<template>
<div class="hr-button-group">
<HLButton id="previous-button" variant="secondary" class="hr-button-group__item hr-button-group__item--left">
<template #iconLeft>
<ChevronLeftIcon />
</template>
Previous
</HLButton>
<HLButton id="next-button" variant="secondary" class="hr-button-group__item hr-button-group__item--right">
Next
<template #iconRight>
<ChevronRightIcon />
</template>
</HLButton>
</div>
</template>
<script setup>
import { HLButton } from '@platform-ui/highrise'
import { ChevronLeftIcon, ChevronRightIcon } from '@gohighlevel/ghl-icons/24/outline'
</script>
With Different Variants
vue
<template>
<div class="hr-button-group">
<HLButton id="cancel-button" variant="secondary" class="hr-button-group__item hr-button-group__item--left"> Cancel </HLButton>
<HLButton id="save-button" variant="primary" class="hr-button-group__item hr-button-group__item--right"> Save </HLButton>
</div>
</template>
Best Practices
- Always provide unique
id
props for each button - Use consistent variants within a group unless intentionally highlighting an action
- Maintain proper order of buttons (e.g., Cancel/No on left, Confirm/Yes on right)
- Use appropriate spacing between button groups
- Consider mobile responsiveness
- Follow accessibility guidelines
- Use clear and concise button labels
- Group related actions together
- Limit the number of buttons in a group
- Use icons consistently across button groups
Breaking Changes
- Removed ButtonGroup component in favor of utility classes
- New class-based styling approach
- Required
id
props for each button - Changed border handling between buttons
- Modified spacing implementation
- Changed rounded corner implementation
- New CSS class structure
- Changed styling implementation
- Modified responsive behavior
- Changed accessibility implementation
Migration Tips
- Replace all UIButtonGroup instances with the new utility class approach
- Add required
id
props to all buttons - Update styling to use the new utility classes
- Review and update any custom styles
- Test responsive behavior
- Verify accessibility compliance
- Update any button group related documentation
- Review and update any component tests
- Check for consistent styling across the application
- Verify proper button order and grouping