Castle UI exports 5 components for RangeSlider:
RangeSlider
: The wrapper that provides context and functionality for all children.RangeSliderTrack
: The empty part of the RangeSlider that shows the track.RangeSliderFilledTrack
: The filled part of the RangeSlider.RangeSliderThumb
: The handle that's used to change the RangeSlider value.
Usage
Import
import {RangeSlider,RangeSliderTrack,RangeSliderFilledTrack,RangeSliderThumb,} from '@passfort/castle'content_copyCopy
The RangeSlider is a multi thumb slider used to select a range of related values. A common use-case of this component is a price range picker that allows a user to set the minimum and maximum price.
Example
Note: We recommend adding a aria-label (default ['min', 'max']
) or aria-labelledby prop to provide an accessible label for the RangeSlider.
content_copyCopy
live example
Discrete RangeSliders
Discrete RangeSliders allow you to snap to predefined sets of values. This can be accomplished using the step prop.
content_copyCopy
live example
Getting the final value when dragging the slider
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.
content_copyCopy
live example
Changing the RangeSlider orientation
content_copyCopy
live example
Getting the final value when dragging the slider
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.
content_copyCopy
live example