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.
Chakra UI export 4 components for Slider:
Slider: The wrapper that provides context and functionality for all children.
SliderTrack: The empty part of the slider that shows the track.
SliderFilledTrack: The filled part of the slider.
SliderThumb: The handle that's used to change the slider value.
Slider component was designed to be composed to make it easy for you to
customize its styles.
Dragging the slider can trigger lots of updates and the user might only be
interested in the final result after sliding is complete. You can use
onChangeEnd for this.
SliderThumb will receive focus whenever
value changes. You can
opt-out of this behavior by setting the value of
false. This is normally used with a "controlled" slider value.
We've exported the
useSlider hook to help users manage and build custom slider
Slider component wraps all its children in the Box
component, so you can pass all
Box props to change its style.
|aria-label||The static string to use used for `aria-label` if no visible label is used.||-|
|aria-labelledby||The static string `aria-labelledby` that points to the ID of the element that serves as label for the slider||-|
|aria-valuetext||The static string to use used for `aria-valuetext`||-|
|css||The emotion's css style object||-|
|defaultValue||The initial value of the slider in uncontrolled mode||-|
|focusThumbOnChange||If `false`, the slider handle will not capture focus when value changes.|
|getAriaValueText||Function that returns the `aria-valuetext` for screen readers. It is mostly used to generate a more human-readable representation of the value for assistive technologies||-|
|id||The base `id` to use for the slider and its components||-|
|isDisabled||If `true`, the slider will be disabled||-|
|isReadOnly||If `true`, the slider will be in `read-only` state||-|
|isReversed||If `true`, the value will be incremented or decremented in reverse.||-|
|max||The maximum allowed value of the slider. Cannot be less than min.|
|min||The minimum allowed value of the slider. Cannot be greater than max.|
|name||The name attribute of the hidden `input` field. This is particularly useful in forms||-|
|onChange||function gets called whenever the slider handle is being dragged or clicked||-|
|onChangeEnd||function gets called whenever the user stops dragging the slider handle.||-|
|onChangeStart||function gets called whenever the user starts dragging the slider handle||-|
|orientation||orientation of the slider|
|step||The step in which increments/decrements have to be made|
|value||The value of the slider in controlled mode||-|
SliderThumb composes Box so you can pass all
to change its style.
SliderFilledTrack composes Box so you can pass all
props to change its style.
SliderTrack composes Box so you can pass all
to change its style.