Skip to main content

SliderXSelector

A slider component with predefined positions to select from multiple options

option 1option 2option 3option 4option 5

<SliderXSelector
optionCount={5}
colors={["#3cc9a3", "#2f8eb8", "#6617a3", "#dea002", "#e00000"]}
className={"sliderXSelectorExample"}
labels={["option 1", "option 2", "option 3", "option 4", "option 5"]}
animationTime={100}
defaultOptionIndex={2}
></SliderXSelector>

Props

NameTypeOptionalDefaultDescription
classNamestringtrueAdditional classname to add to the component
onChangefunctiontrueReturns the index of the selected option
colorsarraytrueArray of RGB,RGBA or HEX colors
optionCountnumberfalseNumber of options
defaultOptionIndexnumbertrue0Initially selected option. Invalid index is defaulted to the min or max index
labelsarraytrueArray of strings for labels. Pass "" for empty label. \n works for linebreaks
idstringtrueCustom ID for the direct slider (<input>) element which overwrites the default generated random ID
optionsEnumSliderXOptionstrueSlider behavior options. Use EnumSliderXOptions
indexnumbertrueAllows to externally control the selection. Invalid indexes are defaulted to min or max index.
animationTimenumbertrue0Time of full animation for selection change in microseconds. Use 0 for instant change.