3.0.3 • Published 3 years ago

roundy v3.0.3

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

roundy

Configurable react round slider. Supports touch events.

Installation

npm i roundy (or yarn add roundy)

Usage

import Roundy from 'roundy';

const {value} = this.state
<Roundy
   value={value}
   min={10}
   max={30}
   stepSize={5}
   radius={100}
   color='pink'
   onChange={value => this.setState({value})}
   onAfterChange={(value, props) => ... }
   overrideStyle={ ... string template as CSS ...}
/>

You can create pie round chart

<Roundy
   arcSize={270}
   min={10}
   max={30}
   rotationOffset={-45}
/>

Or use roundy as a group of sliders:

import { RoundyGroup } from 'roundy'

<RoundyGroup sliders={[
    { value: 30, step: 10, id: 'mjaw', max: 50,  radius: 60, color: 'blueviolet', onChange:(val, props) => console.log(props) },
    { value: 30, step: 10, max: 50, radius: 100 },
    { value: 100, step: 20, max: 200, color: 'orange', radius: 140, sliced: false, step: 1 }
]} />

API

Roundy provides the following API:

PropDescriptionDefault
valuenumber: Slider value50
minnumber: Minimal value0
maxnumber: Maximum value100
stepSizenumber: Step value to snap value0
stepsnumber: Number of steps that will be snapable0
radiusnumber: Slider radius100
colorstring: Active slider color'purple'
bgColorstring: Slider arc color'#ccc'
strokeWidthnumber: Slider arc width15
thumbSizenumber: Size (diameter) of thumb20
slicedboolean: Provide slices based on step valuetrue
onChangefunction: immediate callback function (value, props)null
onAfterChangefunction: callback function after release (value, props)null
overrideStylestring: provide additional class style which will be injected into styled-components classnull
arcSizenumber: Size of the arc. Default is 360, can be between 1 and 360360
rotationOffsetnumber: rotation of the whole circle. Can be between -180 and 1800
renderrender prop function that has a signature: ({value, angle}, props) => Nodenull

Testing

TODO

Contribution

Always happy to take PRs.

3.0.3

3 years ago

3.0.2

4 years ago

2.0.8

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

0.1.0

4 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.3

5 years ago

2.0.4

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago