Migrating from UISpace to HighRise Space
This guide will help you migrate from the UISpace component to the HLSpace component.
Component Implementation Changes
Import Changes
diff
- import { UISpace } from '@gohighlevel/ghl-ui'
+ import { HLSpace } from '@platform-ui/highrise'
Basic Usage Changes
diff
- <UISpace>
- <UIButton>Button 1</UIButton>
- <UIButton>Button 2</UIButton>
- </UISpace>
+ <HLSpace id="space-basic">
+ <HLButton id="btn-1">Button 1</HLButton>
+ <HLButton id="btn-2">Button 2</HLButton>
+ </HLSpace>
Props Changes
Required Changes
GHL-UI Prop | HighRise Prop | Notes |
---|---|---|
- | id | New required prop for accessibility |
align | align | Now strictly typed: 'start' | 'end' | 'center' | 'baseline' | 'stretch' |
justify | justify | Now strictly typed: 'start' | 'end' | 'center' | 'space-around' | 'space-between' | 'space-evenly' |
size | size | New size options: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' or number | [number, number] |
wrapItem | - | Removed, wrapping behavior is now handled internally |
Size Mapping
GHL-UI Size | HighRise Size |
---|---|
'small' | 'sm' |
'medium' | 'md' |
'large' | 'lg' |
Examples
Vertical Layout
diff
- <UISpace vertical>
- <UIButton>Button 1</UIButton>
- <UIButton>Button 2</UIButton>
- </UISpace>
+ <HLSpace id="space-vertical" vertical>
+ <HLButton id="btn-1">Button 1</HLButton>
+ <HLButton id="btn-2">Button 2</HLButton>
+ </HLSpace>
Custom Size
diff
- <UISpace size="large">
- <UIButton>Large Gap</UIButton>
- <UIButton>Between</UIButton>
- </UISpace>
+ <HLSpace id="space-size" size="lg">
+ <HLButton id="btn-1">Large Gap</HLButton>
+ <HLButton id="btn-2">Between</HLButton>
+ </HLSpace>
- <UISpace :size="[16, 24]">
+ <HLSpace id="space-custom" :size="[16, 24]">
Justify Content
diff
- <UISpace justify="space-between">
- <UIButton>Left</UIButton>
- <UIButton>Right</UIButton>
- </UISpace>
+ <HLSpace id="space-justify" justify="space-between">
+ <HLButton id="btn-left">Left</HLButton>
+ <HLButton id="btn-right">Right</HLButton>
+ </HLSpace>
Align Items
diff
- <UISpace align="center">
- <div class="h-8">Small</div>
- <div class="h-16">Large</div>
- </UISpace>
+ <HLSpace id="space-align" align="center">
+ <HLButton id="btn-1" size="lg">Item 1</HLButton>
+ <HLButton id="btn-2" size="sm">Item 2</HLButton>
+ </HLSpace>
Inline Space
diff
- <UISpace inline>
- <UITag>Tag 1</UITag>
- <UITag>Tag 2</UITag>
- </UISpace>
+ <HLSpace id="space-inline" inline>
+ <HLTag id="tag-1">Tag 1</HLTag>
+ <HLTag id="tag-2">Tag 2</HLTag>
+ </HLSpace>
Form Layout Example
vue
<template>
<HLForm>
<HLSpace id="form-space" vertical size="lg">
<HLFormItem label="Name" path="name">
<HLInput id="name" v-model="form.name" />
</HLFormItem>
<HLFormItem label="Email" path="email">
<HLInput id="email" v-model="form.email" />
</HLFormItem>
<HLSpace id="button-space">
<HLButton id="submit" type="primary">Submit</HLButton>
<HLButton id="cancel">Cancel</HLButton>
</HLSpace>
</HLSpace>
</HLForm>
</template>
Best Practices
- Always provide unique
id
props for accessibility - Use semantic size values ('sm', 'md', 'lg') for consistent spacing
- Use numeric values or arrays for custom spacing requirements
- Consider responsive behavior when using wrap property
- Use appropriate justify and align props for layout control
- Nest Space components for complex layouts
- Use vertical spacing for form layouts
- Consider inline prop for text-embedded spacing
Additional Notes
- The component now requires unique IDs for accessibility
- Size values are now more strictly typed
- Custom spacing can be achieved with numeric values
- Wrapping behavior is more consistent
- Alignment and justification options are more strictly typed
- The component supports both flex and inline display modes
- Vertical layout support is unchanged
- Item styling can be controlled through the itemStyle prop
- The component maintains consistent spacing across the application
- All spacing values are standardized according to the design system