runway

Runway

Slider

A customizable slider component for selecting values within a range


30
50
80
30
100

The Slider component creates a highly customizable slider input that can be used to select a value from a range.

You can customize, the track (both active and inactive), the thumb, and the labels.



Usage

javascript

1import { Slider } from "@components/atoms/slider";
2
3<Slider
4    min={0}
5    max={100}
6    step={1}
7    defaultValue={30}
8    onChange={(value) => console.log(value)}
9</Slider>



Props

PropTypeDefaultDescription
minnumber0The minimum value of the slider.
maxnumber100The maximum value of the slider.
stepnumber1The step value of the slider.
defaultValuenumber50The default value of the slider.
showLabelsbooleanfalseIf true, shows the min and max labels.
valuePosition"left" | "right" | "follow" | "none""follow"The position of the value label. Can be "left", "right", "follow" or "" to hide).
colorstring"primary"The color of the slider (uses tailwind.config).
inactiveColorstring"gray"The color of the inactive track (uses tailwind.config).
variant"solid" | "soft""solid"The variant of the slider.
showThumbbooleantrueIf true, shows the thumb.
thumbBorderColorstring"gray"The border color of the thumb (uses tailwind.config).
thumbBorderRadiusstring"lg"The border radius of the thumb (uses Tailwind border radius to shape component).
thumbSizestring"5"The size of the thumb.
thumbBorderbooleantrueIf true, shows the border of the thumb.
thumbScalebooleantrueIf true, scales the thumb on hover.
thumbClassNamestring""Additional Tailwind utility classes for the thumb.
activeTrackWidthstring"3"The width of the active track.
inactiveTrackWidthstring"1"The width of the inactive track.
activeTrackBorderRadiusstring"full"The border radius of the active track (uses Tailwind border radius to shape component).
inactiveTrackBorderRadiusstring"full"The border radius of the inactive track (uses Tailwind border radius to shape component).
activeTrackClassNamestring""Additional Tailwind utility classes for the active track.
inactiveTrackClassNamestring""Additional Tailwind utility classes for the inactive track.
onChangefunction-The change handler for the slider.
classNamestring""Additional Tailwind utility classes.
...propsobject-Any other valid HTML attributes for the input element.

Looks like a lot of props? Don't worry, they are all optional and have sensible defaults.




Examples

Basic Sliders

50
50
50

Slider with Labels

0
50
100

Custom Sliders

50
50
50

Experiment with different props and styles to create sliders that fit your design needs and use cases.