Coder Social home page Coder Social logo

mzusin / react-round-slider Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 7.0 42.85 MB

An accessible and mobile-friendly React Round Slider library, powered by TypeScript and SVG.

Home Page: https://react-round-slider.mzsoft.org/

License: MIT License

JavaScript 12.29% TypeScript 74.60% HTML 12.28% CSS 0.83%
circle-slider circular circular-slider radial-slider range-slider react-circle-slider react-circular-slider react-radial-slider react-range-slider react-range-slider-component react-round-slider round-slider slider

react-round-slider's Introduction

From Idea to Code: Playground & Experiments

Linkedin: miriamzusin GitHub mzusin

Hi there! I'm a full-stack web developer who loves coding, programming, and working on open source projects. I have a passion for developing code projects, tools and libraries that are both functional and challenging. As a tech enthusiast, I'm always eager to learn and stay up-to-date with the latest technologies and trends. If you share my passion for coding and web development, I'd love to connect with you and exchange ideas.

mzusin




mzusin

react-round-slider's People

Contributors

es-tf avatar mzusin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-round-slider's Issues

Cannot resize

I cannot resize the container or component itself. For example I want to give width of 150px and height of 150px etc.

<div className="fusion__newCircle">
                    <RoundSlider
                      min={0}
                      max={3}
                      step={0.1}
                      arrowStep={0.1}
                      round={1}
                      enableTicks={true}
                      ticksCount={30}
                      showTickValues={false}
                      ticksColor="#80BA26"
                      pathStartAngle={90}
                      pathEndAngle={360}
                      ticksWidth={3}
                      ticksHeight={13}
                      pathBgColor={"#e2e2e2"}
                      pointerBgColor={"#80BA26"}
                      pointerBgColorSelected={"#80BA26"}
                      animateOnClick={true}
                      animationDuration={500}
                      onChange={(value) => setController1value(value[0].value)}
                    />
</div>

Advanced Customization Options

Thank you for this lib, it's very polished and works well for our use case! I'm hoping to see if there may be ways to have advanced customization options for ticks, data, and text values.

For the data values list, would there be a way to use objects for that setting like { label: string, value: number | string }[]? We have a case where we need to have labels appear more than once, but they represent different values (our case being a clock showing 12 hour time labels, but the values use 24 hours).

So instead of this, which has duplicated entries and causes issues with how the values are treated when selecting the values:

data: ["12am", "2", "4", "6am", "8", "10", "12pm", "2", "4", "6pm", "8", "10"]

It'd be more like this:

data: [
  { value: 0, label: "12am" }, 
  { value: 2, label: "2" }, 
  { value: 4, label: "4" }, 
  { value: 6, label: "6am" }, 
  { value: 8, label: "8" }, 
  { value: 10, label: "10" }, 
  { value: 12, label: "12pm" }, 
  { value: 14, label: "2" }, 
  { value: 16, label: "4" }, 
  { value: 18, label: "6pm" }, 
  { value: 20, label: "8" }, 
  { value: 22, label: "10" }
 ]

Also, is there any way of dynamically deriving the tick colours based on the values? For example, if the tick is selected, show it highlighted with a different colour. Perhaps something like a selectedTickColor or maybe even a getTickColor(index, value) function for more dynamic use cases?

Similar question for the tick values to show it with a different colour if it's selected, or have a function to derive it based on some other use-case logic?

Lastly, is there a way to customize the center text values more? In my current use case, we want to show the total hours selected on the slider, so like 4 hours. Having something like a getText function would be perfect to customize that to show our calculated text based on the selected values.

I'd be happy to submit a PR if these changes seem like something you'd want to support in this lib!

Missing values

Circle does not take some values.

I realize that it does not take values multiplfy of 0.4 (0.4, 0.8, 1.2, 1.6 etc.)

When I remove

 pathStartAngle={90}
 pathEndAngle={360}

everything works good but I need a start angle of 90 and end of 360.

<RoundSlider
      min={0}
      max={3}
      step={0.1}
      arrowStep={0.1}
      round={1}
      enableTicks={true}
      ticksCount={30}
      ticksColor="#80BA26"
      pathStartAngle={90}
      pathEndAngle={360}
      pathRadius={125}
      hideText={true}
      showTickValues={false}
      ticksWidth={3}
      ticksHeight={13}
      pathBgColor={"#e2e2e2"}
      pointerBgColor={"#80BA26"}
      pointerBgColorSelected={"#80BA26"}
      animateOnClick={true}
      animationDuration={500}
      onChange={(value) => setController1value(value[0].value)}
/>

EDIT:

https://react-round-slider.mzsoft.org/pages/ticks-settings.html

In this example, it does not take some values too!

image

image

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.