1.0.1 • Published 1 year ago

@busshi/react-range-slider v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

publish

React-Range-Slider

A custom React Range Slider component reusable without extra dependency (only React dependencies).

Installation

yarn add @busshi/react-range-slider or npm install @busshi/react-range-slider

Custom range slider properties

PropsTypeDefault valueRequired / Optional
valuenumberrequired
onChange(e: React.ChangeEvent) => voidrequired
minnumber0optional
maxnumber100optional
stepnumber5optional

Custom style properties

PropsTypeDefault valueRequired / Optional
widthstring100pxoptional
heightstring3pxoptional
borderRadiusstring50%optional
backgroundstring#eeeoptional
dotColorstring#306FDBoptional
dotSizestring12pxoptional
activeDotSizestring15pxoptional

Note

Colors can be passed as prop as hex (#FFF), rgb (rgb(255, 255, 255)) or as noun (white).

Usage

import RangeSlider from "@busshi/react-range-slider";
import { useState } from "react";

function App() {
  const [value, setValue] = useState(0);

  return (
    <RangeSlider
      onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
        setValue(+e.target.value);
      }}
      min={0}
      max={100}
      step={5}
      value={value}
      width="100px"
      height="3px"
      borderRadius="50%"
      background="#eee"
      dotColor="#306FDB"
      dotSize="12px"
      activeDotSize="15px"
    />
  );
}

export default App;
1.0.1

1 year ago

1.0.0

1 year ago