2.4.5 • Published 3 years ago

@jsdev63/advanced_react-circular-slider v2.4.5

Weekly downloads
79
License
MIT
Repository
github
Last release
3 years ago

advanced-react-circular-slider

npm.io npm.io

A highly customizable circular slider with no dependencies. See some live demos here!

install

npm install @jsdev63/advanced_react-circular-slider

example

import React from 'react';
import CircularSlider from '@jsdev63/advanced_react-circular-slider';

const App = () => {
    return (
        <CircularSlider
            onChange={ value => { console.log(value); } }
        />
    )
};

export default App;

Use min and max props to define the range of numbers. Use prependToValue/appendToValue if you want to prepend/append e.g. "$" or "°" to the value. Or simply use the data prop and pass any number or string sequence as an array to be spread in 360°. See some live demos here!

import React from 'react';
import CircularSlider from '@jsdev63/advanced_react-circular-slider';

const App = () => {
    return (
<CircularSlider
width={400}
limit={270}
offsetAngle={-45}
labelOffset={20}
direction={1}
data={[
  {
    key: 1,
    value: "STAFFING",
  },
  {
    key: 2,
    value: "TEAM",
  },
  {
    key: 1,
    value: "PROJECT",
  },
  {
    key: 1,
    value: "MANAGED",
  }
]}
knobPosition="bottom"
valueFontSize="2rem"
renderLabelValue={null}
progressLineCap="flat"
progressSize={16}
progressColorFrom={'#5215FC'}
progressColorTo={'#280885'}
doubleLineType="progress"
trackColor="#a9a9a9"
trackSize={16}
knobColor = "blue"
knobSize= {40}
knobEl={<SlideIcon width={40} height={40} />}
>
</CircularSlider>
    )
};

export default App;

Props

proptypedefaultAffects
widthnumber280width of the slider
directionnumber1clockwise (1) or anticlockwise (-1)
minnumber0smallest value
maxnumber360largest value
limitnumber360maximum angle
offsetAnglenumber-45offset angle
dataarray[]array of data to be spread in 360°
dataIndexnumber0initially place knob at a certain value in the array
knobElstringnullknob element
knobColorstring#4e63eaknob color
knobSizenumber32knob size, should be large than track size
hideKnobbooleanfalsehide knob
knobDraggablebooleantrueknob not draggable
knobPositionstringtopknob's 0 position to be top, right, bottom or left
labelstringANGLElabel
labelColorstring#272b77label and value color
labelOffsetnumber20spacing between label and circle
activedlabelColorstring#c54a1bactived label and value color
labelBottombooleanfalselabel position at bottom
labelFontSizestring1remlabel font-size
valueFontSizestring4remlabel value font-size
appendToValuestring''append character to value
prependToValuestring''prepend character to value
renderLabelValuejsxnulladd custom jsx code for the labels and styles
verticalOffsetstring2remvertical offset of the label and value
hideLabelValuebooleanfalsehide label and value
progressColorFromstring#80C3F3progress track gradient start color
progressColorTostring#4990E2progress track gradient end color
progressSizenumber8progress track size
progressLineCapstringroundprogress track cap to be round or flat
trackColorstring#DDDEFBbackground track color
trackSizenumber8background track size
doubleLineTypestringprogresstype of double line progress or track
doubleLineColorstringgradiantdouble line color mode gradiant or null or color string
onChangefuncvalue => {}returns label value

license

MIT License

2.4.5

3 years ago

2.4.4

3 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.3.9

3 years ago

2.3.8

3 years ago

2.3.7

3 years ago

2.3.6

3 years ago

2.3.5

3 years ago