Migrating from UIButton to HighRise Button
This guide will help you migrate from the ghl-ui Button component to the new HighRise Button component.
Component Implementation Changes
Import Changes
diff
- import { UIButton } from '@gohighlevel/ghl-ui'
+ import { HLButton } from '@platform-ui/highrise'
Breaking Changes
The following architectural changes have been made:
Button Types and Variants:
- Old: Used
type
prop with limited options - New: Uses combination of
variant
andcolor
props - More flexible styling system with consistent patterns
- Old: Used
Size System:
- Old: Used 'small', 'medium', 'large'
- New: Uses 'lg', 'md', 'sm', 'xs', '2xs', '3xs'
- More granular size control
Icon System:
- Old: Single
icon
slot - New: Three slots:
icon
,iconLeft
,iconRight
- Better control over icon placement
- Old: Single
Props Changes
New Required Props:
id
: Required for accessibility
Renamed/Changed Props:
type
→ Split intovariant
andcolor
size
→ New standardized values
New Props:
variant
: 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'text'color
: 'blue' | 'gray' | 'red' | 'orange' | 'green'link
: Boolean for text button styling
Removed Props:
active
circle
shape
quaternary
(use variant="tertiary" instead)ghost
(use variant="ghost" instead)linkGray
(use variant="text" with color="gray")
Examples
Basic Button Types
diff
- <UIButton id="primary" type="primary">
+ <HLButton id="primary" variant="primary" color="blue">
Primary Button
</HLButton>
- <UIButton id="error" type="error">
+ <HLButton id="error" color="red" variant="primary">
Error Button
</HLButton>
- <UIButton id="tertiary" type="tertiary">
+ <HLButton id="tertiary" variant="tertiary">
Tertiary Button
</HLButton>
- <UIButton id="tertiary" quarternary>
+ <HLButton id="tertiary" variant="ghost" color="gray">
Tertiary Button
</HLButton>
Text and Ghost Buttons
diff
- <UIButton id="text" text>
+ <HLButton id="text" variant="text" color="gray" link>
Text Button
</HLButton>
- <UIButton id="ghost" ghost>
+ <HLButton id="ghost" variant="ghost" color="gray">
Ghost Button
</HLButton>
- <UIButton id="link-gray" linkGray text>
+ <HLButton id="link" variant="text" color="gray" link>
Link Button
</HLButton>
Size Variants
diff
- <UIButton id="small" size="small">
+ <HLButton id="small" size="sm">
Small Button
</HLButton>
- <UIButton id="medium" size="medium">
+ <HLButton id="medium" size="md">
Medium Button
</HLButton>
- <UIButton id="large" size="large">
+ <HLButton id="large" size="lg">
Large Button
</HLButton>
Icon Buttons
diff
- <UIButton id="icon-button" type="primary">
- <template #icon>
- <Share01Icon class="w-5 h-5"/>
- </template>
- </UIButton>
+ <HLButton id="icon-only" color="blue">
+ <template #iconLeft>
+ <Share01Icon class="w-3" />
+ </template>
+ </HLButton>
diff
- <UIButton id="icon-button" type="primary" icon-placement="left">
- <template #icon>
- <Share01Icon class="w-5 h-5"/>
- </template>
- </UIButton>
+ <HLButton id="icon-only" color="blue">
+ <template #iconLeft>
+ <Share01Icon class="w-3" />
+ </template>
+ </HLButton>
diff
- <UIButton id="icon-button" type="primary" icon-placement="left">
- <template #icon>
- <Share01Icon class="w-5 h-5"/>
- </template>
- </UIButton>
+ <HLButton id="icon-only" color="blue">
+ <template #iconRight>
+ <Share01Icon class="w-3" />
+ </template>
+ </HLButton>
Button Groups
vue
<template>
<div class="flex items-center gap-0">
<HLButton id="group-left" color="blue" class="rounded-r-none border-r-0"> Left </HLButton>
<HLButton id="group-middle" color="blue" class="rounded-none border-r-0"> Middle </HLButton>
<HLButton id="group-right" color="blue" class="rounded-l-none"> Right </HLButton>
</div>
</template>
Type Definitions
typescript
type HLButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'text'
type HLButtonColor = 'blue' | 'gray' | 'red' | 'orange' | 'green'
type HLButtonSize = 'lg' | 'md' | 'sm' | 'xs' | '2xs' | '3xs'
interface HLButtonProps {
id: string
variant?: HLButtonVariant
color?: HLButtonColor
size?: HLButtonSize
disabled?: boolean
loading?: boolean
link?: boolean
}
Default Values
typescript
const defaults = {
variant: 'secondary',
color: 'gray',
size: 'md',
}
Best Practices
- Always provide unique
id
props for accessibility - Use appropriate color and variant combinations
- Maintain consistent sizing across similar buttons
- Use icon slots appropriately for alignment
- Consider mobile touch targets when choosing sizes
- Use link variant for text-only buttons
- Group related buttons with proper styling
- Implement proper loading states
- Follow color semantics (e.g., red for destructive actions)
- Follow accessibility guidelines
Additional Notes
- The component provides built-in responsive design
- Enhanced status visualization with loading states
- Support for RTL layouts
- Improved accessibility features
- Consistent styling across all variants
- Better touch targets for mobile
- Flexible icon placement options
- Integration with other HighRise components
- Support for custom styling via classes
- Built-in support for form submission