Skip to main content

SliderXClassic

Classic slider component with full range, implementing all the available easy styling possibilities.

Note that in this example, TypeScript implementation needs additional elements.

export const SliderXClassicExample = () => {
const [color, setcolor] = useState("rgba(102,23,163,1)");
return (
<div style={{ width: "75%", margin: "auto" }}>
<SliderXClassic
defaultValue={100}
min={0}
max={100}
colors={[color]}
className={"sliderXClassicExample"}
onChange={(e) => {
setcolor(`rgba(102,23,163,${e.target.value / 100})`);
}}
></SliderXClassic>
</div>
);
};

Props

NameTypeOptionalDefaultDescription
minnumbertrue0Minimum value
maxnumbertrue100Maximum value
stepnumbertrue1Specifies the number intervals
classNamestringtrueAdditional classname to add to the component
onChangefunctiontrueReturns the HTMLinput change event
colorsarraytrueArray of RGB,RGBA or HEX colors
defaultValuenumbertrueminSets the initial value of the slider
idstringtrueCustom ID for the direct slider (<input>) element which overwrites the default generated random ID
optionsEnumSliderXOptionstrueSlider behavior options. Use EnumSliderXOptions
valuenumbertrueControls the value of the slider externally.