项目作者: mnkhouri

项目描述 :
A circular slider component for React
高级语言: TypeScript
项目地址: git://github.com/mnkhouri/react-circular-slider.git
创建时间: 2019-05-22T22:40:00Z
项目社区:https://github.com/mnkhouri/react-circular-slider

开源协议:

下载


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

  1. import CircularSlider from "react-circular-slider-svg";
  2. export default () => {
  3. const [value1, setValue1] = useState(20);
  4. const [value2, setValue2] = useState(60);
  5. return (
  6. <CircularSlider
  7. size={200}
  8. trackWidth={4}
  9. minValue={0}
  10. maxValue={100}
  11. startAngle={40}
  12. endAngle={320}
  13. angleType={{
  14. direction: "cw",
  15. axis: "-y"
  16. }}
  17. handle1={{
  18. value: value1,
  19. onChange: v => setValue1(v)
  20. }}
  21. handle2={{
  22. value: value2,
  23. onChange: v => setValue2(v)
  24. }}
  25. arcColor="#690"
  26. arcBackgroundColor="#aaa"
  27. />
  28. );
  29. };