Slider

A Slider component is a UI element that allows users to select a value from a range by sliding a handle along a track. It provides an interactive way to adjust settings, such as volume, brightness, or other continuous values, with smooth transitions. Sliders can be single or multi-valued, enabling users to make precise selections visually, enhancing the overall user experience.

Demo

Rendered live, with the same build of the library you install.

50

Usage

Slider.tsx
import { useState } from 'react';
import { NSlider } from '@nayan-ui/react';
const Slider = () => {
const [value, setValue] = useState(50);
return (
<div>
<NSlider label="Volume" value={value} onChange={setValue} />
</div>
);
};
export default Slider;

Attributes

16 props
NameTypeDefaultDetails
labelReact.ReactNodeOptionalLabel for the slider.
classNamestring' 'You can customise by passing tailwind classes.
labelClassNamestring' 'You can customise by passing tailwind classes.
sliderClassNamestring' 'You can customise by passing tailwind classes.
idstringOptionalID for the slider.
valuenumberOptionalCurrent slider value.
defaultValuenumberOptionalDefault slider value.
minnumberOptionalMinimum slider value.
maxnumberOptionalMaximum slider value.
stepnumberOptionalStep increment for slider.
disabledbooleanfalseWhether the slider is disabled.
orientation'horizontal' | 'vertical'OptionalOrientation of the slider.
onChange(value: number) => voidOptionalCallback when value changes.
aria-labelstringOptionalARIA label for accessibility.
aria-labelledbystringOptionalARIA labelledby for accessibility.
aria-valuetextstringOptionalARIA value text for accessibility.

Tags

Other components solving nearby problems.