Coder Social home page Coder Social logo

mnkhouri / react-circular-slider Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 21.0 1.93 MB

A circular slider component for React

Home Page: https://marc.khouri.ca/react-circular-slider/

TypeScript 97.43% JavaScript 1.94% HTML 0.63%
react circular slider svg round arc input

react-circular-slider's Introduction

React Circular Slider

A full-featured circular slider React component, with full TypeScript definitions. See the docs and examples

Features:

  • Simple to use
  • No dependencies
  • Customizable:
    • Start/stop angle
    • Min/max value
    • 0, 1, or 2 handles
  • SVG based

Example

Install from npm: npm i react-circular-slider-svg

import CircularSlider from "react-circular-slider-svg";

export default () => {
  const [value1, setValue1] = useState(20);
  const [value2, setValue2] = useState(60);
  return (
    <CircularSlider
      size={200}
      trackWidth={4}
      minValue={0}
      maxValue={100}
      startAngle={40}
      endAngle={320}
      angleType={{
        direction: "cw",
        axis: "-y"
      }}
      handle1={{
        value: value1,
        onChange: v => setValue1(v)
      }}
      handle2={{
        value: value2,
        onChange: v => setValue2(v)
      }}
      arcColor="#690"
      arcBackgroundColor="#aaa"
    />
  );
};

react-circular-slider's People

Contributors

andreas-berg avatar dependabot[bot] avatar maiconcarraro avatar mnkhouri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-circular-slider's Issues

Block the slider at both ends

Thank you for your package, very useful.

Currently (although it's a circle and there's not really a "start" and "end") as a user, its obvious that the bottom is 0% and you turn clockwise to move your way to 100%.

We would very much like to be able to stop the circle from infinitely turning and making it difficult to pick 100%.

When turning clockwise it's easy to go from 100% to 0% and vice-versa when going from 0% counter-clockwise it's easy to go to 100%.

ezgif com-video-to-gif

Is there currently a way to block the limits? We tried the min and max props without any luck!

Cheers

feature request: add on mouse up function

I need to update my database when the slider has finished sliding. The onChange event given on the handle feeds to many changes... Can you add an onMouseUp event that fires once the user has finished using the slider? thanks!

Tooltips to handle

Is there a way to add a tooltip to the tooltip to the handle? Like so

image

trackWidth as a prop

Can we have the trackWidth as a prop, i see that you use trackWidth as 4 now. Btw thankyou for this great tool !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.