Skip to content

Slider

Slider control for selecting a single value or a range.

Volume
<ControlledSingleSlider {...args} />
Price range
<ControlledRangeSlider label="Price range" value={[20, 80]} />
Completion
50
<ControlledSingleSlider
label="Completion"
marks={defaultMarks}
value={50}
valueDisplay="text"
/>
Budget
$250
<ControlledSingleSlider
formatValue={value => `$${value}`}
label="Budget"
max={500}
step={25}
value={250}
valueDisplay="text"
/>
Opacity
60%
<ControlledSingleSlider
formatValue={value => `${value}%`}
label="Opacity"
value={60}
valueDisplay="text"
/>
Brightness
<ControlledSingleSlider label="Brightness" value={40} valueDisplay="none" />
Level
65
<div style={{height: 220}}>
<ControlledSingleSlider
label="Level"
orientation="vertical"
value={65}
valueDisplay="text"
/>
</div>
Disabled volume
<ControlledSingleSlider isDisabled label="Disabled volume" value={50} />
Volume
90
<ControlledSingleSlider
label="Volume"
status={{
message: 'Volume is above the recommended range.',
type: 'error',
}}
value={90}
valueDisplay="text"
/>
Allowed range
30 - 60
<ControlledRangeSlider
label="Allowed range"
minStepsBetweenThumbs={2}
step={5}
value={[30, 60]}
valueDisplay="text"
/>
Step 5
45
Step 0.1
0.5
<VStack gap={6}>
<ControlledSingleSlider
label="Step 5"
step={5}
value={45}
valueDisplay="text"
/>
<ControlledSingleSlider
formatValue={value => value.toFixed(1)}
label="Step 0.1"
max={1}
step={0.1}
value={0.5}
valueDisplay="text"
/>
</VStack>
Temperature
70
<ControlledSingleSlider
label="Temperature"
marks={[
{label: '-50F', value: -50},
{label: '0F', value: 0},
{label: '100F', value: 100},
{label: '200F', value: 200},
]}
max={200}
min={-50}
step={10}
value={70}
valueDisplay="text"
/>

Slider control for selecting a single value or a range.

When isOptional: false, isRequired: false

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionstringSupporting text displayed below the label.
formatValue(value: number) => stringCustom value formatter used for visible value text, tooltip content, and aria-valuetext.
isDisabledbooleanfalseWhether the slider is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringField label.
labelTooltipstringTooltip content shown next to the label.
marksSliderMark[]Tick marks rendered along the track.
maxnumber100Maximum value.
minnumber0Minimum value.
orientation"horizontal" | "vertical"'horizontal'Slider orientation.
refRef<HTMLDivElement>Ref forwarded to the field root.
statusInputStatusValidation status displayed below the slider.
stepnumber1Step increment.
styleCSSPropertiesInline styles applied to the field root.
valueDisplay"none" | "text" | "tooltip"'tooltip'How to display the current value.
isOptionalfalse
isRequiredfalse
minStepsBetweenThumbsnumber0Minimum number of steps between range thumbs.
onChange*(value: [number, number]) => voidCalled when the range changes during pointer or keyboard interaction.
onChangeEnd(value: [number, number]) => voidCalled when pointer or keyboard interaction commits a range.
value*[number, number]Current range.

When isOptional: true, isRequired: false

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionstringSupporting text displayed below the label.
formatValue(value: number) => stringCustom value formatter used for visible value text, tooltip content, and aria-valuetext.
isDisabledbooleanfalseWhether the slider is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringField label.
labelTooltipstringTooltip content shown next to the label.
marksSliderMark[]Tick marks rendered along the track.
maxnumber100Maximum value.
minnumber0Minimum value.
orientation"horizontal" | "vertical"'horizontal'Slider orientation.
refRef<HTMLDivElement>Ref forwarded to the field root.
statusInputStatusValidation status displayed below the slider.
stepnumber1Step increment.
styleCSSPropertiesInline styles applied to the field root.
valueDisplay"none" | "text" | "tooltip"'tooltip'How to display the current value.
isOptional*true
isRequiredfalse
minStepsBetweenThumbsnumber0Minimum number of steps between range thumbs.
onChange*(value: [number, number]) => voidCalled when the range changes during pointer or keyboard interaction.
onChangeEnd(value: [number, number]) => voidCalled when pointer or keyboard interaction commits a range.
value*[number, number]Current range.

When isOptional: false, isRequired: true

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionstringSupporting text displayed below the label.
formatValue(value: number) => stringCustom value formatter used for visible value text, tooltip content, and aria-valuetext.
isDisabledbooleanfalseWhether the slider is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringField label.
labelTooltipstringTooltip content shown next to the label.
marksSliderMark[]Tick marks rendered along the track.
maxnumber100Maximum value.
minnumber0Minimum value.
orientation"horizontal" | "vertical"'horizontal'Slider orientation.
refRef<HTMLDivElement>Ref forwarded to the field root.
statusInputStatusValidation status displayed below the slider.
stepnumber1Step increment.
styleCSSPropertiesInline styles applied to the field root.
valueDisplay"none" | "text" | "tooltip"'tooltip'How to display the current value.
isOptionalfalse
isRequired*true
minStepsBetweenThumbsnumber0Minimum number of steps between range thumbs.
onChange*(value: [number, number]) => voidCalled when the range changes during pointer or keyboard interaction.
onChangeEnd(value: [number, number]) => voidCalled when pointer or keyboard interaction commits a range.
value*[number, number]Current range.

When isOptional: false, isRequired: false

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionstringSupporting text displayed below the label.
formatValue(value: number) => stringCustom value formatter used for visible value text, tooltip content, and aria-valuetext.
isDisabledbooleanfalseWhether the slider is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringField label.
labelTooltipstringTooltip content shown next to the label.
marksSliderMark[]Tick marks rendered along the track.
maxnumber100Maximum value.
minnumber0Minimum value.
orientation"horizontal" | "vertical"'horizontal'Slider orientation.
refRef<HTMLDivElement>Ref forwarded to the field root.
statusInputStatusValidation status displayed below the slider.
stepnumber1Step increment.
styleCSSPropertiesInline styles applied to the field root.
valueDisplay"none" | "text" | "tooltip"'tooltip'How to display the current value.
isOptionalfalse
isRequiredfalse
onChange*(value: number) => voidCalled when the value changes during pointer or keyboard interaction.
onChangeEnd(value: number) => voidCalled when pointer or keyboard interaction commits a value.
value*numberCurrent value.

When isOptional: true, isRequired: false

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionstringSupporting text displayed below the label.
formatValue(value: number) => stringCustom value formatter used for visible value text, tooltip content, and aria-valuetext.
isDisabledbooleanfalseWhether the slider is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringField label.
labelTooltipstringTooltip content shown next to the label.
marksSliderMark[]Tick marks rendered along the track.
maxnumber100Maximum value.
minnumber0Minimum value.
orientation"horizontal" | "vertical"'horizontal'Slider orientation.
refRef<HTMLDivElement>Ref forwarded to the field root.
statusInputStatusValidation status displayed below the slider.
stepnumber1Step increment.
styleCSSPropertiesInline styles applied to the field root.
valueDisplay"none" | "text" | "tooltip"'tooltip'How to display the current value.
isOptional*true
isRequiredfalse
onChange*(value: number) => voidCalled when the value changes during pointer or keyboard interaction.
onChangeEnd(value: number) => voidCalled when pointer or keyboard interaction commits a value.
value*numberCurrent value.

When isOptional: false, isRequired: true

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionstringSupporting text displayed below the label.
formatValue(value: number) => stringCustom value formatter used for visible value text, tooltip content, and aria-valuetext.
isDisabledbooleanfalseWhether the slider is disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringField label.
labelTooltipstringTooltip content shown next to the label.
marksSliderMark[]Tick marks rendered along the track.
maxnumber100Maximum value.
minnumber0Minimum value.
orientation"horizontal" | "vertical"'horizontal'Slider orientation.
refRef<HTMLDivElement>Ref forwarded to the field root.
statusInputStatusValidation status displayed below the slider.
stepnumber1Step increment.
styleCSSPropertiesInline styles applied to the field root.
valueDisplay"none" | "text" | "tooltip"'tooltip'How to display the current value.
isOptionalfalse
isRequired*true
onChange*(value: number) => voidCalled when the value changes during pointer or keyboard interaction.
onChangeEnd(value: number) => voidCalled when pointer or keyboard interaction commits a value.
value*numberCurrent value.