Skip to content

Slider

Slider component for selecting a value within a given range, supporting drag interaction, step intervals, and vertical orientation.

Basic Usage

The simplest slider with two-way data binding via v-model.

0
vue
<template>
  <u-slider v-model="value" />
</template>

<script setup>
  import { ref } from 'vue';
  const value = ref(0);
</script>

Set Color

Set the slider color via color prop. Available colors: primary, success, warning, error.

30
30
30
30
vue
<template>
  <u-slider v-model="value" color="success" />
</template>

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

Range & Step

Set the range via min and max props, and the step interval via step prop.

50
30
0
vue
<template>
  <u-slider v-model="value1" :max="200" />
  <u-slider v-model="value2" :step="10" />
  <u-slider v-model="value3" :step="0.1" />
</template>

<script setup>
  import { ref } from 'vue';
  const value1 = ref(50);
  const value2 = ref(30);
  const value3 = ref(0);
</script>

Vertical Mode

Set vertical prop to enable vertical slider mode.

30
30
vue
<template>
  <u-slider v-model="value" vertical />
</template>

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

Disabled State

Disable the slider via disabled prop.

30
vue
<template>
  <u-slider v-model="value" disabled />
</template>

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

Custom Size

Customize the thumb and track size via thumbSize and trackSize props.

30
60
vue
<template>
  <u-slider v-model="value1" thumbSize="28px" trackSize="10px" />
  <u-slider v-model="value2" thumbSize="14px" trackSize="4px" />
</template>

<script setup>
  import { ref } from 'vue';
  const value1 = ref(30);
  const value2 = ref(60);
</script>

USlider API

PropertyDescriptionTypeDefault
modelValueCurrent valuenumber0
minMinimum valuenumber0
maxMaximum valuenumber100
stepStep intervalnumber1
disabledWhether to disablebooleanfalse
colorSlider color'primary' | 'success' | 'warning' | 'error'-
verticalWhether vertical modebooleanfalse
thumbSizeSize of the thumb handlestring'20px'
trackSizeSize of the track barstring'6px'

USlider Events

EventDescriptionType
changeTriggered when value changes (after drag ends)(value: number) => void