4.1.0 • Published 2 months ago

dha-slider v4.1.0

Weekly downloads
3
License
-
Repository
-
Last release
2 months ago

dha-slider

This module is a React Slider component to be used in your applications.

Getting Started

Install

Install from npm:

  • npm i dha-slider

A note about styles

Starting in version 4.0.1, the styles are no longer included in the import. You will need to import the styles separately.

import { Slider } from 'dha-slider';
import 'dha-slider/dist/style.css'; //Add this line somewhere in your project

If you do not import the styles, the slider may fail to render properly.

Slider Component

Slider Props:

PropTypeOptionalDefaultDescription
valuenumbernoN/AThe value of the slider
onChange(value: number) => voidnoN/AFunction called when the slider value changes
orientationstringyes'horizontal'The orientation of the Slider
isDisabledbooleanyesundefinedWhether the whole Slider is disabled
onChangeEnd(value: number) => voidyesundefinedFired when the slider stops moving
minValuenumberyes0The slider's minimum value
maxValuenumberyes100The slider's maximum value
stepnumberyes1The slider's step value
labelstringyesundefinedThe label for the slider
lowerTagstringyesundefinedThe lower tag for the slider
upperTagstringyesundefinedThe upper tag for the slider
colorThumbstringyes'#07192d'The color of the thumb
colorThumbActivestringyes'#092068'The color of the thumb when active
formatOptionsIntl.NumberFormatOptionsyesundefinedFormat options for the number formatter

Example of using Slider module in a functional component:

import { Slider } from 'dha-slider';
import 'dha-slider/dist/style.css';

const Home = () => {
  const [sliderValue, setSliderValue] = useState(50);

  return (
    <>
      <Slider
        lowerTag={'Relaxed'}
        upperTag={'Anxious'}
        label="Anxiety"
        value={sliderValue}
        onChange={setSliderValue}
      />
    </>
  );
};
export default Home;

Contribute

see Github wiki

NPM

https://www.npmjs.com/package/dha-slider

License

pending

4.1.0

2 months ago

4.0.3

11 months ago

4.0.1

11 months ago

4.0.0

11 months ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.1

3 years ago

1.3.0

4 years ago

1.2.12

5 years ago

1.2.11

5 years ago

1.2.10

5 years ago