Migrating from ghl-ui Slider to HighRise InputSlider
This guide will help you migrate from the ghl-ui Slider component to the new HighRise InputSlider component.
Component Implementation Changes
Import Changes
diff
- import { UISlider } from '@gohighlevel/ghl-ui'
+ import { HLInputSlider } from '@platform-ui/highrise'Basic Usage Changes
diff
- <UISlider v-model:value="value" />
+ <HLInputSlider id="input-slider" v-model:value="value" type="single" :min="0" :max="100" />Form Integration Changes
diff
- <UIForm :model="formModel">
- <UIFormItem label="Rating">
- <UISlider
- v-model:value="formModel.rating"
- />
- </UIFormItem>
- </UIForm>
+ <HLForm :model="formModel" :rules="rules">
+ <HLFormItem
+ label="Rating"
+ path="rating"
+ required
+ >
+ <HLInputSlider
+ id="rating-slider"
+ v-model:value="formModel.rating"
+ />
+ </HLFormItem>
+ </HLForm>Props Changes
| ghl-ui Prop | HighRise Prop | Notes |
|---|---|---|
v-model:value | v-model:value | Same binding; emits update:value |
size | size | Token changes to sm | md | lg (form-injected); default md |
| - | type | New: 'single' | 'dual'; default 'dual' (ghl-ui was single by default) |
| - | showInput | New: renders numeric inputs beside the slider |
| - | showMinMax | New: toggles min/max labels beside the rail (default true) |
| - | formatTooltip | New default formatter value => \${value}%``; accepts custom formatter |
tooltip | tooltip | Same meaning; disabled when the slider is disabled |
min/max | min/max | Same meaning; defaults remain 0 / 100 |
step | step | Same meaning; defaults to 1 |
marks | - | Not supported in HighRise; use step, showMinMax, or custom labels instead |
Examples
Basic InputSlider
vue
<template>
<HLInputSlider id="basic-slider" v-model:value="value" :min="0" :max="100" type="single" />
</template>
<script setup>
import { HLInputSlider } from '@platform-ui/highrise'
import { ref } from 'vue'
const value = ref(30)
</script>Dual Handle with Number Inputs
vue
<template>
<HLInputSlider
id="range-slider"
v-model:value="range"
type="dual"
:min="0"
:max="100"
:step="5"
:show-input="true"
:show-min-max="true"
/>
</template>
<script setup>
import { ref } from 'vue'
import { HLInputSlider } from '@platform-ui/highrise'
const range = ref<[number, number]>([20, 60])
</script>InputSlider with Different Sizes
vue
<template>
<div class="space-y-4">
<HLInputSlider id="slider-lg" v-model:value="value" size="lg" :min="0" :max="100" />
<HLInputSlider id="slider-md" v-model:value="value" size="md" :min="0" :max="100" />
<HLInputSlider id="slider-sm" v-model:value="value" size="sm" :min="0" :max="100" />
</div>
</template>
<script setup>
import { HLInputSlider, HLForm, HLFormItem } from '@platform-ui/highrise'
import { ref } from 'vue'
const value = ref(50)
</script>InputSlider with Number Input
vue
<template>
<HLInputSlider id="slider-input" v-model:value="value" :min="0" :max="100" :show-input="true" />
</template>
<script setup>
import { ref } from 'vue'
import { HLInputSlider } from '@platform-ui/highrise'
const value = ref(50)
</script>InputSlider with Custom Tooltip
vue
<template>
<HLInputSlider id="slider-tooltip" v-model:value="value" :min="0" :max="10" :format-tooltip="val => `${val} pts`" />
</template>
<script setup>
import { ref } from 'vue'
import { HLInputSlider } from '@platform-ui/highrise'
const value = ref(5)
</script>Breaking Changes
- Handle mode: defaults to dual; set
type="single"for a single handle - Marks:
marksprop is not available; usestep,showMinMax, or custom labels instead - Sizes: tokens change to
sm/md/lgwith defaultmd - Inputs:
showInputandshowMinMaxare new controls for number fields and rail labels - Tooltips: default formatter is now
${value}%; provideformatTooltipfor custom text - IDs:
idis optional (auto-generated when omitted)
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 labels
- Implement proper error handling
- Consider using tooltips for additional information
- Handle disabled states properly
- Use consistent spacing and alignment
- Consider step size appropriateness
- Handle min/max value constraints
- Use appropriate marks for context
- Consider number input visibility
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
- Supports value format validation
- Handles value parsing and formatting
- Supports custom value formats
- Provides clear value input validation
- Supports range selection
- Handles mark customization