Skip to content

Slider

An input where the user selects a value from within a given range.

Basic Usage

Value: 50
Example

Range

If the bound value is an array, it automatically renders as a dual-thumb range slider.

Range: 25 - 75
Example

Marks & Steps

You can set step values and use the marks prop to display custom marks. Use showTooltip to display the current value on hover/drag.

0°C
20°C
50°C
100°C
Example

Sizes

Use the size prop to control the size of the slider. Supported sizes are xs, sm, md (default), lg, xl, 2xl.

Extra Small (xs)
Small (sm)
Medium (md) - Default
Large (lg)
Extra Large (xl)
2X Large (2xl)
Example

States

Use the disabled prop to disable the slider, or the isError prop to show a validation error state.

Disabled:
Error:
Example

Theming

Global Customization (BrConfigProvider)

You can easily override the default slider appearance (colors, background) using the BrConfigProvider.

Themed Slider

Example

Local Customization (TailwindCSS)

You can pass Tailwind classes directly to target specific parts of the slider.

vue
<template>
  <div class="w-[60%] py-8">
    <BrSlider 
      v-model="value" 
      class="[&_[data-radix-slider-range]]:bg-green-500 [&_[data-radix-slider-thumb]]:border-green-500 [&_[data-radix-slider-thumb]]:border-4"
    />
  </div>
</template>

API

Props

NameTypeDefaultDescription
modelValuenumber | number[]undefinedBound value of the slider. Array for range slider.
defaultValuenumber | number[][0]Default value for uncontrolled state.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Step size.
disabledbooleanfalseWhether the slider is disabled.
orientation'horizontal' | 'vertical''horizontal'Orientation of the slider.
dir'ltr' | 'rtl''ltr'Reading direction.
invertedbooleanfalseWhether to visually invert the slider.
minStepsBetweenThumbsnumber0Minimum permitted steps between thumbs.
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl''md'Size variant of the slider.
marksboolean | Record<number, string>falseCustom marks on the track.
showTooltipboolean | 'always' | 'hover'falseShow tooltip on hover/active.
isErrorbooleanfalseError state for form validation.

Emits

NameDescriptionParameters
update:modelValueTriggered when value changes(value: number | number[])
valueCommitTriggered when interaction ends (e.g. mouse up)(value: number | number[])