Slider

Slider and RangeSlider components

Slider component props

NameTypeDescription
colorMantineColorKey of theme.colors or any valid CSS color, controls color of track and thumb, theme.primaryColor by default
defaultValuenumberUncontrolled component default value
disabledbooleanDisables slider
hiddenInputPropsReact.ComponentPropsWithoutRef<"input">Props passed down to the hidden input
invertedbooleanDetermines whether track value representation should be inverted, false by default
labelReactNode | ((value: number) => ReactNode)Function to generate label or any react node to render instead, set to null to disable label
labelAlwaysOnbooleanDetermines whether the label should be visible when the slider is not being dragged or hovered, false by default
labelTransitionPropsTransitionPropsProps passed down to the Transition component, { transition: 'fade', duration: 0 } by default
marks{ value: number; label?: ReactNode; }[]Marks displayed on the track
maxnumberMaximum possible value, 100 by default
minnumberMinimal possible value, 0 by default
namestringHidden input name, use with uncontrolled component
onChange((value: number) => void)Called when value changes
onChangeEnd((value: number) => void)Called when user stops dragging slider or changes value with arrows
precisionnumberNumber of significant digits after the decimal point
radiusMantineRadius | numberKey of theme.radius or any valid CSS value to set border-radius, numbers are converted to rem, 'xl' by default
restrictToMarksbooleanDetermines whether the selection should be only allowed from the given marks array, false by default
scale((value: number) => number)A transformation function to change the scale of the slider
showLabelOnHoverbooleanDetermines whether the label should be displayed when the slider is hovered, true by default
sizenumber | MantineSize | (string & {})Controls size of the track, 'md' by default
stepnumberNumber by which value will be incremented/decremented with thumb drag and arrows, 1 by default
thumbChildrenReact.ReactNodeContent rendered inside thumb
thumbLabelstringThumb aria-label
thumbPropsReact.ComponentPropsWithoutRef<"div">Props passed down to thumb element
thumbSizestring | numberThumb width and height, by default value is computed based on size prop
valuenumberControlled component value

RangeSlider component props

NameTypeDescription
colorMantineColorKey of theme.colors or any valid CSS color, controls color of track and thumb, theme.primaryColor by default
defaultValueRangeSliderValueUncontrolled component default value
disabledbooleanDisables slider
hiddenInputPropsReact.ComponentPropsWithoutRef<"input">Props passed down to the hidden input
invertedbooleanDetermines whether track values representation should be inverted, false by default
labelReactNode | ((value: number) => ReactNode)Function to generate label or any react node to render instead, set to null to disable label
labelAlwaysOnbooleanDetermines whether the label should be visible when the slider is not being dragged or hovered, false by default
labelTransitionPropsTransitionPropsProps passed down to the Transition component, { transition: 'fade', duration: 0 } by default
marks{ value: number; label?: ReactNode; }[]Marks displayed on the track
maxnumberMaximum possible value, 100 by default
maxRangenumberMaximum range interval, Infinity by default
minnumberMinimal possible value, 0 by default
minRangenumberMinimal range interval, 10 by default
namestringHidden input name, use with uncontrolled component
onChange((value: RangeSliderValue) => void)Called when value changes
onChangeEnd((value: RangeSliderValue) => void)Called when user stops dragging slider or changes value with arrows
precisionnumberNumber of significant digits after the decimal point
radiusMantineRadius | numberKey of theme.radius or any valid CSS value to set border-radius, numbers are converted to rem, 'xl' by default
restrictToMarksbooleanDetermines whether the selection should be only allowed from the given marks array, false by default
scale((value: number) => number)A transformation function to change the scale of the slider
showLabelOnHoverbooleanDetermines whether the label should be displayed when the slider is hovered, true by default
sizenumber | MantineSize | (string & {})Controls size of the track, 'md' by default
stepnumberNumber by which value will be incremented/decremented with thumb drag and arrows, 1 by default
thumbChildrenReact.ReactNodeContent rendered inside thumb
thumbFromLabelstringFirst thumb aria-label
thumbProps((index: 0 | 1) => Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">)Props passed down to thumb element based on the thumb index
thumbSizestring | numberThumb width and height, by default value is computed based on size prop
thumbToLabelstringSecond thumb aria-label
valueRangeSliderValueControlled component value