Slider
Slider generates a background element that can be used for various purposes.
<Slider />
Props
Color
size
orientation
valueLabelDisplay
5e-8
<Slider
aria-label="Small steps"
defaultValue={0.00000005}
getAriaValueText={valueText}
step={0.00000001}
marks
min={-0.00000005}
max={0.0000001}
valueLabelDisplay="auto"
/>
20
<Slider
aria-label="Custom marks"
defaultValue={20}
getAriaValueText={valueText}
step={10}
valueLabelDisplay="auto"
marks={marks}
/>
80
<Slider
aria-label="Always visible"
defaultValue={80}
getAriaValueText={valueText}
step={10}
marks={marks}
valueLabelDisplay="on"
/>
Keep label at edges
For horizontal slider on mobile viewports, the value label might be offset from the track. Apply the style to keep the label at the start/end edges:
0100
Range slider
By passing an array of values to the value
prop, you can use the Slider
to set the start and end of a range.
2037
<Slider
getAriaLabel={() => 'Temperature range'}
value={value}
onChange={handleChange}
valueLabelDisplay="auto"
getAriaValueText={valueText}
/>
Track
The track shows the range available for user selection.
Removed track
The track can be turned off with track={false}
.
Removed track
Removed track range slider
Inverted track
Inverted track range
3
<Slider />
CSS variables
px
px
px
px
px
Unstyled
The component also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size.