Skip to content

Slider

This component is used to select one or more values within a given range, commonly used for volume control, brightness adjustment, price range filtering, and similar scenarios.

  • Supports single value selection and range selection
  • Supports step size and tick mark display
  • Supports vertical mode
  • Customizable slider track colors

Notice

This component may have slight differences in appearance across platforms. Please refer to the actual effect.

Platform Differences

App (vue)App (nvue)H5Mini Program

Basic Usage

  • Bind the slider value via v-model, default value is 0.
  • Set the value range via min and max, default is 0 to 100.
html
<see-slider v-model="value" />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref(30);
</script>

Range Selection

  • Set isRange to true to enable range selection mode.
  • In this mode, the v-model binding value should be an array, such as [20, 80].
html
<see-slider v-model="value" isRange />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref([20, 80]);
</script>

Step and Tick Marks

  • Set the step size via step.
  • Set isShowStep to true to display tick marks.
html
<see-slider v-model="value" :step="10" isShowStep />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref(40);
</script>

Show Current Value

  • Set isShowValue to true to display the current value next to the slider thumb.
html
<see-slider v-model="value" isShowValue />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref(50);
</script>

Vertical Mode

  • Set isVertical to true to switch to vertical mode.
html
<see-slider v-model="value" isVertical style="height: 200px;" />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref(30);
</script>

Custom Colors

  • Set the active track color via activeColor.
  • Set the inactive track color via inactiveColor.
html
<see-slider v-model="value" activeColor="#07c160" inactiveColor="#eee" />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref(60);
</script>

Disabled State

  • Set isDisabled to true to disable the slider.
  • In disabled state, drag events will not trigger, and the style will turn gray or reduce in transparency.
html
<see-slider v-model="value" isDisabled />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref(50);
</script>

Readonly State

  • Set isReadonly to true to set the slider to readonly state.
  • In readonly state, drag events will not trigger, but the style remains unchanged.
html
<see-slider v-model="value" isReadonly />

<script lang="ts" setup>
import { ref } from 'vue';
const value = ref(50);
</script>

API

Props

ParameterDescriptionTypeDefaultOptional ValuesPlatform Notes
modelValueBinding valuenumber | number[]0--
minMinimum valuenumber0--
maxMaximum valuenumber100--
stepStep sizenumber1Any positive number-
isDisabledWhether disabledbooleanfalsetrue, false-
isReadonlyWhether readonlybooleanfalsetrue, false-
isRangeWhether it is range selectionbooleanfalsetrue, false-
isVerticalWhether it is vertical modebooleanfalsetrue, false-
barHeightTrack height (px)number4Any positive number-
activeColorActive track colorstring-Any CSS color value-
inactiveColorInactive track colorstring-Any CSS color value-
isShowValueWhether to show current valuebooleanfalsetrue, false-
isShowStepWhether to show tick marksbooleanfalsetrue, false-
sizeSize"small" | "default" | "large"'default'small, default, large-
nameForm field namestring''--

Events

Event NameDescriptionCallback Parameters
onChangeTriggered when value changesvalue: Current value
onDragStartTriggered when starting to drag the slider thumbvalue: Current value
onDragEndTriggered when ending drag of the slider thumbvalue: Current value

Liao ICP No. 2025070134