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

Usage

import { NSlider } from '@nayan-ui/react';
const Slider = () => {
return (
<NSlider defaultValue={50} max={100} step={1} disabled={false} onChange={value => console.log(value)} />
);
};
export default Slider;

Attributes

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.