Slider

The Slider is used to allow users to make selections from a range of values.

Sliders reflect a range of values along a bar, from which users may select a single value. They are ideal for adjusting settings such as volume, brightness, or applying image filters.

Import#

import {
  CSlider,
  CSliderTrack,
  CSliderFilledTrack,
  CSliderThumb
} from '@chakra-ui/vue'

Usage#

Editable Example
<c-slider default-value="56">
  <c-slider-track />
  <c-slider-filled-track />
  <c-slider-thumb />
</c-slider>

Changing the slider color#

Editable Example
<c-slider color="pink" default-value="24">
  <c-slider-track />
  <c-slider-filled-track />
  <c-slider-thumb />
</c-slider>

Props#

Slider Props#

The Slider component wraps all its children in the Box component, so you can pass all Box props to change its style.

NameTypeDefaultDescription
valuenumberThe value of the slider.
defaultValuenumberThe initial value of the slider.
maxnumberStandard input max attribute.
minnumberStandard input min attribute.
stepnumberStandard input step attribute.
aria-labelstringThe accessible label.
aria-labelledbystringThe id of the element that labels the sliders
aria-valuetextstringThe aria-valuetext of the switch for accessibility.
orientationstringThe orientation of the slider, only horizontal is supported for now.
getAriaValueText(value: number ): stringThe callback to format the aria-valuetext.
sizesm, md, lgThe size of the slider.
colorstringThe color scheme to use for the slider. Use a color key in theme.colors
namestringThe name of the slider component when used in a form.
idstringThe id of the slider component when used in a form.

Slider Events#

NameDescription
changeCallback fired when the value of the slider changes.
onFocusCallback fired when the thumb receives focus
blurCallback fired when the thumb is blurred
mouseDownCallback fired when you mousedown on any part of the slider
keyDownCallback fired when you keydown on any part of the slider

Slots#

NameDescription
defaultSlot for the children of the slider.

SliderThumb Props#

SliderThumb composes PseudoBox so you can pass all PseudoBox props to change its style.

SliderFilledTrack Props#

SliderFilledTrack composes PseudoBox so you can pass all PseudoBox props to change its style.

SliderTrack Props#

SliderTrack composes Box so you can pass all Box props to change it's style.

❤️ Contribute to this page

Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!