Skip to main content

Slider (Item)

Example

import { components } from "replugged";
const { SliderItem } = components;

export function Settings(): React.ReactElement {
return (
<SliderItem
{...util.useSetting(cfg, "foo", 0)}
minValue={0}
maxValue={100}
markers={[0, 25, 50, 75, 100]}>
Slider title
</SliderItem>
);
}

Enums

EnumDescription
Slider.MarkerPositionsSlider marker positions
ABOVE | BELOW

Props

NameTypeDefaultDescription
asValueChanges(value: number) => voidFunction ran on grabber move
barClassNamestringBar element class name
barStylesCSSPropertiesBar element style
classNamestringComponent class name
defaultValuenumberDefault value, marked in green
disabledbooleanfalseWhether the slider is disabled
equidistantbooleanfalseWhether the markers are equidistant from each other
fillStylesCSSPropertiesBar fill element style
getAriaValueText(value: number) => voidFunction ran on grabber move
grabberClassNamestringGrabber element class name
grabberStylesCSSPropertiesGrabber element style
hideBubblebooleanfalseWhether the tooltip is hidden when stickToMarkers is false
initialValuenumber10Initial value the slider grabber is at; alias of value
keyboardStepnumber1By how much the slider grabber has to move if the keyboard is used
markerPositionSlider.MarkerPositionsSlider.MarkerPositions.ABOVEMarker position
markersnumber[]Array of slider markers
maxValuenumber100Slider maximum value
minibooleanfalseWhether the slider grabber is a small dot
minValuenumber0Slider minimum value
onChange(value: number) => voidFunction ran on value change
onMarkerRender(value: number) => stringFunction ran on marker render, useful to customize markers
onValueChange(value: number) => voidFunction ran on value change; alias of onChange
onValueRender(value: number) => stringFunction ran on value render, useful to customize values
orientationstringSlider orientation
renderMarker(marker: number) => ReactElementFunction ran on marker render, useful to use a custom marker element
stickToMarkersbooleanfalseWhether the slider grabber can stick to markers
valuenumberSlider value