useSlider

useSlider is a custom hook used to provide slider functionality, as well as state and focus management to custom slider components when using it.

Import#

import { useSlider } from '@fluidtruck/core'

Return value#

The useSlider hook returns the following props

NameTypeDescription
stateSliderStateAn object that contains all the props that define the current state of the slider.
actionsSliderActionsAn object that contains all the functions that can be called to modify the slider's value
getRootPropsPropGetterA function that takes slider root props and handles changes for the slider.
getTrackPropsPropGetterA function that takes slider track props and handles changes for the slider's track.
getInnerTrackPropsPropGetterA function that takes slider inner track style props and handles changes in the slider's inner track style.
getThumbPropsPropGetterA function that takes slider thumb props and handles changes for the slider's thumb.
getMarkerPropsRequiredPropGetter<{ value: number }>A function that takes the value of the marker and handles changes for the slider's marker positioning and style.
getInputPropsPropGetterA function to get the props of the input field.

Usage#

Parameters#

The useSlider hook accepts an object with the following properties: